Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

document[name] has no properties error in netscape

Status
Not open for further replies.

hablablow

Programmer
Sep 9, 2000
115
FR
I mixed different Js together in order to have visual effects on my page.
They perfectly work separately.
The problem appears in netscape on a rollover effect when i mix them.
The communicator console shows me this message:

"document[name] has no properties"

The script i use for the rollover is quite simple, it goes like this:
---------------------------------------------------------------------------------------------------
<SCRIPT LANGUAGE=&quot;javascript&quot;>
var NN3 = false;
image1= new Image();
image1.src = &quot;popup/uneed.gif&quot;;
image1on = new Image();
image1on.src = &quot;popup/uneed.gif&quot;;
image1alt = new Image();
image1alt.src = &quot;popup/bm1.gif&quot;;
image1alton = new Image();
image1alton.src = &quot;popup/bm1_what_roll.gif&quot;;
function on3(name) {
document[name].src = eval(name + &quot;on.src&quot;);
document[&quot;hbl&quot;].src = eval(name + &quot;alton.src&quot;);
}
function off3(name) {
document[name].src = eval(name + &quot;.src&quot;);
document[&quot;hbl&quot;].src = eval(name + &quot;alt.src&quot;);
}
NN3 = true;
function on(name) {
if (NN3) on3(name);
}
function off(name) {
if (NN3) off3(name);
}
</SCRIPT>
--------------------------------------------------------------------------------------------------

Then goes the usual OnMouseOver and Out in the body tag.
This works perfectly alone on both browers, but not when i mix it with other JS.
So what is the missing element to make it work on netscape ?
Anyone knows ?
[sig][/sig]
 
Try using another variable name, instead of 'name' for your function argument. 'name' is a reserved word. (Notice <img src=&quot;something&quot; name=&quot;something&quot;>)

Also, please show us how you call the function in your HTML. [sig][/sig]
 
Here are the two lines in my body concerned by the above Js
As i said this generates an error in netscape not in Msie.

The Js console in netscape shows me this message: &quot;document[name] has no properties&quot;

I use this Js in order to swap diferent images in different cells together.
This code works perfectly on its own in both navigators

<A HREF=&quot;#&quot;><IMG SRC=&quot;popup/bm1.gif&quot; NAME=&quot;hbl&quot; BORDER=&quot;0&quot; WIDTH=&quot;221&quot; HEIGHT=&quot;34&quot;></A>
<A HREF=&quot;#&quot; ONMOUSEOVER=&quot;on('image1');&quot; ONMOUSEOUT=&quot;off('image1')&quot;>
<IMG SRC=&quot;popup/uneed.gif&quot; ONLOAD=&quot;&quot; BORDER=&quot;0&quot; NAME=&quot;image1&quot; WIDTH=&quot;35&quot; HEIGHT=&quot;34&quot;></A>

I don't know why netscape is not accepting it.
If somedy knows, would be great. [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top