Support » How-To and Troubleshooting » Inserting JavaScript in html editor gets messed up

Inserting JavaScript in html editor gets messed up

  • I put the following JavaScript into an HTML file, copy it the server, and everything works just fine:
    <script language=”JavaScript” type=”text/javascript”>

    In WordPress, I attempt to enter the same text into the HTML editor as a post (TinyMCE is turned off) and this is what ends up in the file that is eventually displayed (this is what shows up in the page source after fetching the page from WordPress):

    <script language="JavaScript" type="text/javascript"><br />
    addPTViewerParameter(”file”,”IMG_0085_0360.jpg”);<br /> addPTViewerParameter(”fov”,”92″);<br />
    addPTViewerParameter(”wait”,”controlimages/wait.gif”);<br />
    addPTViewerParameter(”auto”,”.25″);<br />
    InsertPTVApplet(”viewer”,640,500);<br />

    Note the conversion of quotes into ” and the insertion of <br/> throughout the JavaScript.

    Is there any way to turn off this conversion and insertion of <br>? Remember, this is all being done in the html editor with TinyMCE disabled for this user (me).


    (I’m not sure what a ‘backticks’ is here so its possible my code example will be turned to mush in the above.)

Viewing 2 replies - 1 through 2 (of 2 total)
  • Well, it didn’t display as I intended. In the 2nd set of Javascript the quotes should all be displayed as “& # 8 2 2 1;” without the spaces. Even though this translates back to quotes here (and elsewhere) if I copy this code directly to the original HTML file, it no longer works.

    I’d just like to keep my javascript exactly as I originally wrote it without conversion.

    After further thought, I assume the html editor eliminates all quotes for storage as a text string. Too bad.

    I suppose I might write some php code that could insert the necessary script.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Inserting JavaScript in html editor gets messed up’ is closed to new replies.