Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window.onload not working? 1

Status
Not open for further replies.

tiamat2012

Programmer
Dec 12, 2004
144
US
Hello all,

I'm trying to do some setting of my code with the window.onload function, but its not working. My javascript code is:

Code:
[blue]
window.onload
{
    ConvertColumnHands("tlmenu");
}
[/blue]
function send(var addy)
{
 		window.location=addy;
}
      
function ConvertColumnHands(xTableId)
{

 		var cols = document.getElementById(xTableId).getElementsByTagName("td");
   
    for(i=0; i<cols.length; i++)
		{
     		
        cols[i].onmouseover = new Function("this.className='highlight'");
        cols[i].onmouseout = new Function("this.className=''");
          
    }
}
</script>

does anyone have any ideas?

You can checkout the whole website at kerryj.awardspace.com/index.html

Thank you for your time,
Kerry
 
Thank you for that correction, but it still doesn't work.

I created a blank new page and inserted only the following code and nothing happened:

Code:
<script language="text/javascript">
 
window.onload = function() {
 		alert("hello!");
}
</script>

Sincerely,
Kerry
 
Try this:

window.onload = alert("hello!");

or

window.onload = ConvertColumnHands("tlmenu");

Lee
 
I tried that, didn't work.

Do any of you have a page where it does work? Is it possible that it's my hosting (I'm using a free hosting service)

-Kerry
 
If the client has active scripting disabled, you would not get it done. Otherwise the correct syntax [tt]window.onload=function() {alert("hello!");}[/tt] should show up the message. If the client has a text only browser, you cannot get it neither. Otherwise, no other reason I can think of.
 
Thank you Dan! That was it, I changed the type and it worked right off the bat.

Thank you everyone for the help,
Kerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top