473,321 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 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

<SCRIPT LANGUAGE="JAVASCRIPT">
<!--

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

//-->
</SCRIPT>

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 1214


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:

[snip]
<SCRIPT LANGUAGE="JAVASCRIPT">
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;

[snip]
onmouseover="roll('sub_but1',
'http://www.kidsoft.org.uk/buttons/home1a.gif')"
onmouseout="roll('sub_but1',
'http://www.kidsoft.org.uk/buttons/home1.gif')"
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/>.

Mike

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Andy R. | last post by:
Hello everyone, I've spent quite some time now, looking for some information on how to get this done, sadly none has helped me much, though. I have a bit of java scrpt on a webpage (.php) to...
2
by: Ola Fjelddahl | last post by:
hi. I load a script dynamically and it works * everytime with IE6. * sometimes! with Mozilla1.5 <- makes me curious * never with Opera7.11 all tests on WindowsXP. With "sometimes" I mean
4
by: Derek | last post by:
I have the following script in a page and it gets an error in IE 6. Says something about an invalid argument but the line number doesn't help since I can't see the javascript code when viewing...
14
by: Pascal Damian | last post by:
My HTML pages have a <SCRIPT SRC=http://remote/script> at the top'ish of each page. Sometimes the remote host (probably due to heavy load or flaky network connectivity) doesn't respond for a long...
2
by: webbedfeet | last post by:
Hi I hope someone can help me. I have a client side form validation script which works perfectly in IE but clicking "Submit" in Mozilla does nothing - the form won't submit. Is there something I...
1
by: philippe.laplanche | last post by:
Hello I want to dynamically include a .js file i.e do something like that : load_js_file("http://domain.com/myfile.js"); is it possible with internet explorer 6 ? Thanks in advance
1
by: cwdjrxyz | last post by:
I am now writing many new pages in xhtml 1.1. They are served as true xhtml by setting the mime type of the server to application/xhtml+xml for the .xhtml extension. Since IE6 and some earlier...
15
by: Lennart | last post by:
Hi folks, I have created an animated image gallery in dhtml. It works fine in Internet Explorer. In Firefox, it only works if I ommit the DOCTYPE tag. The page is valid xhtml-strict but with a...
2
by: boczek | last post by:
Hello all. I'm writing a small async webapp. in JavaScript and I'm using <script> element technique to load data. I'm usign <scriptbecause of cross domain restrictions with XmlRequest. The...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.