[thelist] javascript problem
Hans-Fr=?ISO-8859-1?B?6WTp?=ric Fraser
hfraser at videotron.ca
Mon Jan 6 09:53:01 CST 2003
On 1/6/03 10:27 AM, "Scott Brady" <evolt at scottbrady.net> wrote:
>> Am passing a value to a js function i.e.
>> showPopupMenu(document.all.popupMenuDivDR03-0003 )
>>. But on the function itself if i try
>> alerting the passed value, i get "NAN". How can i get an object i.e.
>
> I believe the problem is the hyphen in the div's id. When you pass that into
> the function call, it's trying to subtract 3 from
> document.all.popupMenuDivDR03, which obviously doesn't work.
>
> Rename your div to something else (I'm not even sure if putting a hyphen in
> the id will validate) and see if it works.
you could go by a different route!
the call!:
showPopupMenu('popupMenuDivDR03-0003');
the function:
function showPopupMenu(myLayerId){
var myObject = document.getElementById(myLayerId);
// alert : the object
window.alert(myObject);
// do something with the object like setting it's display!
myObject.style.display = 'none';
}
that way you can name your layer the way you already have them named without
any weird subtracting!
hans!
More information about the thelist
mailing list