471,055 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,055 software developers and data experts.

Script works in Mozilla but not IE6 (latest versions)?

Hi i get an error on this line of my script. It works in mozilla but not IE6

Here is the error message

document[...] is null or not an object

Here is the function - also images for this button rollover are preloaded


function roll(img_name, img_src)
document[img_name].src = img_src;


call function with this

onmouseover="roll('sub_but1', 'http://www.kidsoft.org.uk/buttons/home1a.gif')"
onmouseout="roll('sub_but1', 'http://www.kidsoft.org.uk/buttons/home1.gif')"

Any ideas or subtle pointers

many thanks
Jul 23 '05 #1
2 1106

These are usually identifier conflicts. Try a more explicit scope:

function roll(img_name, img_src)
document.images[img_name].src = img_src;

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #2
On 5 Dec 2004 18:43:44 -0800, mark <ki*****@dsl.pipex.com> wrote:

The language attribute has been deprecated for over six years. Use the
(required) type attribute instead:

<script type="text/javascript">
Hiding scripts like that is also an out-dated practice.
function roll(img_name, img_src)
document[img_name].src = img_src;
There is no reason for a named image to be a property of the document
object. Images have their own collection, images, so it's best to use that:

document.images[img_name].src = img_src;

That's a very cumbersome way to perform rollovers.
Any ideas or subtle pointers

Have a look at <URL:http://www.mlwinter.pwp.blueyonder.co.uk/image-swap/>.


Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Andy R. | last post: by
2 posts views Thread by Ola Fjelddahl | last post: by
14 posts views Thread by Pascal Damian | last post: by
1 post views Thread by philippe.laplanche | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.