By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,567 Members | 1,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,567 IT Pros & Developers. It's quick & easy.

over has no properties

P: n/a
here's some more code i inherited on a project:

function set_background(pic){
if(pic==""){
if(ie4)over.backgroundImage="none";
if(ns6)over.style.backgroundImage="none";
}else{
if(ns4){
over.background.src=pic;
}else if(ie4){
over.backgroundImage="url("+pic+")";
}else if(ns6){
over.style.backgroundImage="url("+pic+")";
}
}
}

i'm getting an error that says "over has no properties" when i look at
this in firefox. is this the wrong syntax for over
Oct 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

Matt wrote:
here's some more code i inherited on a project:

function set_background(pic){
if(pic==""){
if(ie4)over.backgroundImage="none";
if(ns6)over.style.backgroundImage="none";
}else{
if(ns4){
over.background.src=pic;
}else if(ie4){
over.backgroundImage="url("+pic+")";
}else if(ns6){
over.style.backgroundImage="url("+pic+")";
}
}
}

i'm getting an error that says "over has no properties" when i look at
this in firefox. is this the wrong syntax for over


The syntax is correct. However, what I would like to know is what is
"over" referencing to? From the looks of all that you gave, over is a
global variable. Has "over" been assigned something in the global
scope? Double check to make sure "over" is referencing something.

Oct 17 '05 #2

P: n/a
Matt wrote :
here's some more code i inherited on a project:

function set_background(pic){
if(pic==""){
if(ie4)over.backgroundImage="none";
I doubt IE4 supports background-image anyway
if(ns6)over.style.backgroundImage="none";
}else{
if(ns4){
over.background.src=pic;
}else if(ie4){
over.backgroundImage="url("+pic+")";
I doubt IE4 supports background-image anyway
}else if(ns6){
over.style.backgroundImage="url("+pic+")";
}
}
}

i'm getting an error that says "over has no properties" when i look at
this in firefox. is this the wrong syntax for over


You need to define the id attribute for such element. Then you can
access such element with document.getElementById: this creates a
reference to a scriptable node.

e.g.:

var ElementReference = null;

ElementReference = document.getElementById("over");

More on this and other issues:

Using Web Standards in Your Web Pages
http://www.mozilla.org/docs/web-deve...tml#dom_access

Gérard
--
remove blah to email me
Oct 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.