Words From a Purple Mind

Input on the important topics …to me of course

Convert HTML / Script to Javascript include source

There are instances where you want to convert HTML/JavaScript source. Some people use AJAX, ASPX or other types of code to do “includes”.

I normally build my include page in html first to make sure I like the look of it then I put it in a page that converts it for inclusion.

To ensure that any HTML that you want generated from Javascript document.write statements does not get misinterpreted as Javascript a backslash () is placed in front of certain characters in the text. Each line of HTML source is also separated by n so that the linefeeds will be correctly inserted into the generated HTML.

Below is where you can create your include code automatically. Bookmark this page as you will use it more and more…and the best part is…it’s free to use.

To ensure that any HTML that you want generated from Javascript document.write statements does not get misinterpreted as Javascript a backslash () is placed in front of certain characters in the text. Each line of HTML source is also separated by n so that the linefeeds will be correctly inserted into the generated HTML.

Paste your HTML (including script) code into the following form and press the Convert button and the required changes will be made to your code. It also encloses the code into document.write statements for you.

Take the code from the bottom box and save it to where you need. Make sure you save it with a .js extension.

Put the following code into the page & position you would like the include to be in: