HighDots Forums  

is this syntax correct?

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss is this syntax correct? in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bob
 
Posts: n/a

Default is this syntax correct? - 07-01-2004 , 01:36 PM






Hi,

I want to fill a Select dynamically but get syntax error:
......
optieuu=document.createElement("option")
optieuu.text = rng[i]
optieuu.value = ur[i]
document.getElementById("uu").options.add optieuu
....

and to delete elements:
....
uu.selectedIndex=1
uu.remove.selectedIndex
....

Is the syntax in both cases correct?
Thanks
Bob



Reply With Quote
  #2  
Old   
Andre Herbst
 
Posts: n/a

Default Re: is this syntax correct? - 08-07-2004 , 02:24 PM






Bob wrote:

Quote:
document.getElementById("uu").options.add optieuu
this has to be:

document.getElementById("uu").add(optieuu)


Quote:
uu.selectedIndex=1
uu.remove.selectedIndex
You could write instead:

document.getElementById("uu").remove(1)

now it should be correct




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.