Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Cannot access custom attributes in Firefox / Opera

Reply
Thread Tools

Cannot access custom attributes in Firefox / Opera

 
 
cardalda@gmail.com
Guest
Posts: n/a
 
      09-23-2006
Hi all,
When I add custom attributes to a TextBox, I can read them out in
javascript under IE6.
For example:

in C#
TextBox1.Attributes.Add("MyString", "ABC");
TextBox1.Attributes.Add("TestMe(this)");

in Javascript I can do

function TestMe(editbox)
{
alert(editbox.MyString); // --> shows ABC
}

Under Firefox / Opera I get an "Undefined"

Does anybody know why this happens and can this be solved?

Thanks,
RRenzo.

 
Reply With Quote
 
 
 
 
Jon Paal
Guest
Posts: n/a
 
      09-25-2006
use document.getElementById

<(E-Mail Removed)> wrote in message news:(E-Mail Removed) oups.com...
> Hi all,
> When I add custom attributes to a TextBox, I can read them out in
> javascript under IE6.
> For example:
>
> in C#
> TextBox1.Attributes.Add("MyString", "ABC");
> TextBox1.Attributes.Add("TestMe(this)");
>
> in Javascript I can do
>
> function TestMe(editbox)
> {
> alert(editbox.MyString); // --> shows ABC
> }
>
> Under Firefox / Opera I get an "Undefined"
>
> Does anybody know why this happens and can this be solved?
>
> Thanks,
> RRenzo.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DOM access speed mini BenchMark : Safari vs FireFox vs Opera Jorge Javascript 3 07-02-2008 07:38 PM
WebControl.Attributes.Add and custom attributes P4trykx ASP .Net 2 01-31-2007 04:33 PM
Comparisons of IE, Opera and Firefox on DOM (Javascript/CSS) support(Opera wins) Bob HTML 24 05-21-2006 05:31 PM
Any way to read custom html attributes in firefox/opera ? andyjgw@gmail.com Javascript 3 06-30-2005 05:11 PM
Opera 7.53 vs Opera 6.0 ? Hockey Buff Computer Support 3 08-17-2004 08:53 PM



Advertisments