![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | getElemetById doesn't work in VBscipt I'm writing code in VBscript for a web project and I find the getElementById method seems doesn't work in VBscipt.the code "set obj=eval('input1')" work,but when the code is "set obj=document.getElement ById('input1')",I get "nothing" by "msgbox typeName(obj)".what is the matter? jtz |
My System Specs![]() |
| | #2 (permalink) |
| | Re: getElemetById doesn't work in VBscipt Your sample code has a typo (space) in "getElement ById". And vbscript uses double-quotes for string literals... If you didn't paste that, then show your actual code and the html fragment defining "input1" Tim "jtz" <jtz@xxxxxx> wrote in message news:EC1D21FE-2455-4573-B002-C2D00B484149@xxxxxx Quote: > I'm writing code in VBscript for a web project and I find the > getElementById > method > seems doesn't work in VBscipt.the code "set obj=eval('input1')" work,but > when the code is "set obj=document.getElement ById('input1')",I get > "nothing" > by "msgbox typeName(obj)".what is the matter? > jtz |
My System Specs![]() |
| | #3 (permalink) |
| | Re: getElemetById doesn't work in VBscipt Maybe I've missed something, but I've never understood why that function is necessary. It works perfeclt well to just use input1 as an object if there's an element with that ID in the page. Quote: > I'm writing code in VBscript for a web project and I find the Quote: > method > seems doesn't work in VBscipt.the code "set obj=eval('input1')" work,but > when the code is "set obj=document.getElement ById('input1')",I get Quote: > by "msgbox typeName(obj)".what is the matter? > jtz |
My System Specs![]() |
| | #4 (permalink) |
| | Re: getElemetById doesn't work in VBscipt in fact ,I have a lot of inputs in page ,and I have to iterate these inputs and get their values.But it is probably that some inputs do not exist,so I have to use getElemetById mothod to check if the input does exist(using eval finction will get error),so my actual code is"for i=0 to n set obj=document.getElemetById("input"&i) if not(obj is nothing )then ........",but everytime obj is returned as nothing,I have no idea what is the matter and how to solve this problem. -- jtz "mayayana" wrote: Quote: > Maybe I've missed something, but I've never > understood why that function is necessary. > It works perfeclt well to just use input1 as an > object if there's an element with that ID in > the page. |
My System Specs![]() |
| | #5 (permalink) |
| | Re: getElemetById doesn't work in VBscipt On Nov 11, 1:27*am, jtz <j...@xxxxxx> wrote: Quote: > in fact ,I have a lot of inputs in page ,and I have to iterate these inputs > and get their values.But it is probably that some inputs do not exist,so I > have to use getElemetById mothod to check if the input does exist(using eval > finction will get error),so my actual code is"for i=0 to n * *set > obj=document.getElemetById("input"&i) * if not(obj is nothing )then > .......",but everytime obj is *returned as nothing,I have no idea what is the > matter and how to solve this problem. > -- > jtz > > "mayayana" wrote: Quote: > > *Maybe I've missed something, but I've never > > understood why that function is necessary. > > It works perfeclt well to just use input1 as an > > object if there's an element with that ID in > > the page. for i=0 to n set obj=document.getElemetById("input"&i) if not(obj is nothing) then ... next Then there is a typo in the function call. You have the function as getElemetById, when it should be getElemeNtById. However, since it is fairly obvious that you are NOT using cut-and- paste as Tim Williams suggested, it's almost impossible to determine if that's your problem or not. Tom Lavedas *********** http://there.is.no.more/tglbatch/ |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| speakers randomly wont work sometimes on laptop but external will sometime work | Sound & Audio | |||
| Calling Excel PMT from VBScipt vs. PowerShell... | PowerShell | |||
| all cd's don't work, but dvd's still work | Vista hardware & devices | |||
| HP LaserJet 1010 don't work in Vista since Beta2 - Advanced 1384 Printing Support drivers for XP don't work | Vista print fax & scan | |||
| Will all the programs that work on xp work on vista? | Vista General | |||