Web Analytics Made Easy -
StatCounter Is this possbile using JScript...? - CodingForum

Announcement

Collapse
No announcement yet.

Is this possbile using JScript...?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is this possbile using JScript...?

    OK,let's say I want to add to some tags an attribute,like <IMG NOCLICK src=...>
    Then I want to automatically set the event handlers using JScript(I know how to do this).
    Really,the quiestion is,can I add custom attributes to HTML tags,and then use JScript to manipulate them...?

    Regards
    CW

  • #2
    As far as I know that can't be done in [x]html, but in xml it would definitely possible. But who knows, maybe there is some obscure way to do it.

    Comment


    • #3
      IE would allow it, or least it used to but I stopped doing it cause no other browsers would allow it, another solution is to use XML where u define the dtd urself.

      Comment


      • #4
        Any browser will allow it (AFAIK) - the page just won't validate.

        Now, I don't know about attributes without values, but valued attributes should work just fine.
        My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
        “Minds are like parachutes. They don't work unless they are open”
        “Maturity is simply knowing when to not be immature”

        Comment


        • #5
          Originally posted by beetle
          Any browser will allow it (AFAIK) - the page just won't validate.

          Now, I don't know about attributes without values, but valued attributes should work just fine.
          Good,now can anyone direct me to the proper link?

          Comment


          • #6
            all you reall need is

            elem.setAttribute( sAttribute, sValue );

            and

            elem.getAttribute( sAttribute );
            My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
            “Minds are like parachutes. They don't work unless they are open”
            “Maturity is simply knowing when to not be immature”

            Comment

            Working...
            X