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 are coming my comands in cells of a table

<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.
 
Try changing the use of 'name' as a variable name for your function argument.

I don't know for sure if this is the problem, but remember, in the Document Object Model, 'name' is an object property (not a variable name). For example, the 'name' property for an object is referenced by 'document.object.name', so maybe Netscape is looking for the 'name' attribute to 'document' rather than an object named after the variable 'name'.
 
First thank you for your replies Rycamor.
I understand the meaning of your posts but i can't manage it with my script.
Remember if you want that netscape is perfectly accepting this script as it is when
i use it alone. The problem appears when i mix it with another timeline script
to move layers. I tryed to give the variable 'name' another name such as 'swap' or
anything else. I still have this message: document .swap has no properties.
I don't know, looks like chineese to me.
 
Well, why don't you give me a link to your whole page, or show the complete page code (enclosed in
Code:
blocks please). Then we will see how one script is interfering with the other.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top