473,372 Members | 861 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,372 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 1216


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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.