...

View Full Version : I'm completely stumped, but I'm sure it's an easy problem



questor
08-12-2005, 11:45 PM
Why am I getting object expected when onload occurs?

<html>
<head>
<script>
function allButtonsUp();
{
var buttonArray = new Array("home","skills","experience","achievements","education","contact");
for (var i=0; i<buttonArray.length; i++)
{
var j = buttonArray[i];
document.getElementById(j).innerHTML = '<img src="' + j + '_up.jpg">';
}
}

function buttonDown(buttonName)
{
document.getElementById(buttonName).innerHTML = '<img src="' + buttonName + '_down.jpg">';
}

function buttonUp()
{
document.getElementById(buttonName).innerHTML = '<img src="' + buttonName + '_up.jpg">';
}

</script>
</head>
<body onload="allButtonsUp();">

<center><img src="banner2.jpg"></center><br>
<table name="buttontable"><tr>
<td><div id="home" onmouseover="buttonDown('home');" onmouseout="buttonUp('home');"></div></td>
<td><div id="skills" onmouseover="buttonDown('skills');" onmouseout="buttonUp('skills');"></div></td>
<td><div id="experience" onmouseover="buttonDown('experience');" onmouseout="buttonUp('experience');"></div></td>
<td><div id="achievements" onmouseover="buttonDown('achievements');" onmouseout="buttonUp('achievements');"></div></td>
<td><div id="education" onmouseover="buttonDown('education');" onmouseout="buttonUp('education');"></div></td>
<td><div id="contact" onmouseover="buttonDown('contact');" onmouseout="buttonUp('contact');"></div></td>
</tr></table>

</body>
</html>

vwphillips
08-13-2005, 12:00 AM
function allButtonsUp(){


you have allButtonsUp();
{

Willy Duitt
08-13-2005, 12:01 AM
function allButtonsUp();

HINT: Turn on script debugging...

.....Willy

questor
08-13-2005, 12:11 AM
LOL thanks ROFL

vwphillips
08-13-2005, 12:17 AM
also this is an alternative to using innerHTML

(I havent got the right images but you will see the idea)


<html>
<head>
<script>
var ImgPath='http://www.vicsjavascripts.org.uk/StdImages/';
var buttonArray = new Array("One","Two","Three","Four","Five");

function allButtonsUp(){
for (var i=0; i<buttonArray.length; i++){
var j = buttonArray[i];
obj=document.createElement('IMG');
obj.src=ImgPath+j+'.gif';
document.getElementById(j).appendChild(obj);
obj.width='50';
obj.height='50';
}
}

function button(buttonName,sufix){
document.getElementById(buttonName).src = ImgPath+buttonName+suffix+'.gif">';
}

</script>
</head>

<body onload="allButtonsUp();">

<center><img src="banner2.jpg"></center><br>
<table name="buttontable"><tr>
<td><div id="One" onmouseover="button('One','_down');" onmouseout="button('One','_up);"></div></td>
<td><div id="Two" onmouseover="button('Two','_down');" onmouseout="button('Two','_up);"></div></td>
<td><div id="Three" onmouseover="button('Three','_down');" onmouseout="button('Three','_up);"></div></td>
<td><div id="Four" onmouseover="button('Four','_down');" onmouseout="button('Four','_up);"></div></td>
<td><div id="Five" onmouseover="button('Five','_down');" onmouseout="button('Five','_up);"></div></td>
</tr></table>

</body>
</html>

questor
08-13-2005, 12:35 AM
is there a problem with using innerHTML?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum