[thelist] javascript problem
Hans-Frédéric Fraser
thelist at lists.evolt.org
Mon Jan 6 09:53:01 2003
On 1/6/03 10:27 AM, "Scott Brady" <evolt at scottbrady.netrote:
>> 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!