Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #15897

Re: Accessing properties of <input type="text" id="DetailsView1_txtRowNumber"... />

Date 2012-09-15 19:48 +0200
From Luuk <luuk@invalid.lan>
Newsgroups comp.lang.javascript
Subject Re: Accessing properties of <input type="text" id="DetailsView1_txtRowNumber"... />
References <3c28749c-3ca1-4983-bb5e-3176eae2b007@googlegroups.com> <g88ei9-8q9.ln1@luuk.invalid.lan> <k32btu$smv$1@dont-email.me>
Message-ID <hjrei9-kqe.ln1@luuk.invalid.lan> (permalink)

Show all headers | View raw


On 15-09-2012 18:55, Martin Leese wrote:
> Luuk wrote:
>> <html>
>> <head>
>> <title>title</title>
>> <script>
>> function testthis() {
>>     alert('testthis');
>>     var i=document.getElementsByTagName('input');
>>     alert ('Type:'+i[0].type);
>>     alert ('id:'+i[0].id);
>
> id's are unique within a page, so can just use:
>      var i=document.getElementById('DetailsView1_txtRowNumber');
>      alert ('Type:'+i.type);
>
>> }
>> </script>
>> </head>
>> <body onload="testthis();">
>> <input type="text" id="DetailsView1_txtRowNumber"... />
>> </body>
>> </html>
>

yep,
But most of the times you will have more than one 'input'...
And i cannot think why *every* input should have a unique id....

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Accessing properties of <input type="text" id="DetailsView1_txtRowNumber"... /> chaimzv@gmail.com - 2012-09-15 03:36 -0700
  Re: Accessing properties of <input type="text" id="DetailsView1_txtRowNumber"... /> Luuk <luuk@invalid.lan> - 2012-09-15 14:17 +0200
    Re: Accessing properties of <input type="text" id="DetailsView1_txtRowNumber"... /> Martin Leese <please@see.Web.for.e-mail.INVALID> - 2012-09-15 10:55 -0600
      Re: Accessing properties of <input type="text" id="DetailsView1_txtRowNumber"... /> Luuk <luuk@invalid.lan> - 2012-09-15 19:48 +0200
  Re: Accessing properties of <input type="text" id="DetailsView1_txtRowNumber"... /> chaimzv@gmail.com - 2012-09-15 12:26 -0700
    Re: Accessing properties of <input type="text" id="DetailsView1_txtRowNumber"... /> chaimzv@gmail.com - 2012-09-15 12:27 -0700

csiph-web