function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
wpatterswpatters 

Visualforce Javascript Problems

Hi, I'm pretty new with visualforce, and I've created a page using html/css/javascript that I want to make into a visualforce page.  The HTML & CSS are working fine, but the javascript is not working at all.  I tried making the javascript file into a static resource, and I couldn't figure out how to call the functions, so I put the javascript right into the html head within <script> tags.  Now it is completely changing my javascript when I run it.

This is the original code:
Code:
var tds=document.getElementsByTagName('td');
for(i=0; i<tds.length; i++){
if(tds[i].className=="selected"){
tds[i].className="regular";}
}

And this is what happens to it when I run the VF page
Code:
var tds=document.getElementsByTagName('td');
for(i=0; i<tds className="regular" .length; i++){
if(tds[i].className=="selected"){
tds[i].;}
}
}

You'll notice that it totally moved everything after the tds[i]. up into the for loop.  There are other places where it is modifying my code, apparantly randomly.  How do I stop this??


Message Edited by wpatters on 10-20-2008 09:13 AM
dchasmandchasman
See this post for the cause and workaround.