Cannot access custom attributes in Firefox / Opera

Discussion in 'ASP .Net' started by cardalda@gmail.com, Sep 23, 2006.

  1. Guest

    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.
    , Sep 23, 2006
    #1
    1. Advertising

  2. Jon Paal Guest

    use document.getElementById

    <> wrote in message news:...
    > 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.
    >
    Jon Paal, Sep 25, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bob
    Replies:
    24
    Views:
    1,541
  2. P4trykx
    Replies:
    2
    Views:
    1,807
    bruce barker
    Jan 31, 2007
  3. Replies:
    3
    Views:
    94
    AndrewW
    Jun 30, 2005
  4. custom attributes in firefox

    , Sep 19, 2006, in forum: Javascript
    Replies:
    3
    Views:
    118
  5. Jorge
    Replies:
    3
    Views:
    139
    Gregor Kofler
    Jul 2, 2008
Loading...

Share This Page