Computer Science Canada

Simple Internet Explorer Error; can't figure it out

Author:  asteffes [ Tue May 30, 2006 3:28 pm ]
Post subject:  Simple Internet Explorer Error; can't figure it out

Hello all,

When I load up my webpage, I get:

"
Error line 13
Document[...] is null or not an object"

Here is my javascript @ line 13:

<script language="javascript" type="text/javascript">

function movepic(img_name,img_src)
{
document[img_name].src=img_src;
}

</script>

I call this function with a mouseover event to change the image:

<a href="Index.aspx"
onmouseover="movepic('Home','App_Themes/Theme/Images/Home-over.jpg')"
onmouseout="movepic('Home','App_Themes/Theme/Images/Home.jpg')">
<img id="Home" src="App_Themes/Theme/Images/Home.jpg" border="0" width="150" height="35" style="border:0" alt="Home"/></a>

Any help would be greatly appreciated, thanks in advance

Author:  rdrake [ Wed May 31, 2006 11:38 am ]
Post subject: 

Typically you need to do something like the following to modify an object's styles:
code:
document.getElementById[img_name].style
Of course, you will need each image to have an id="" attribute added to their tags.


: