SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Oct 2006
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Defining methods for html elements

    Hello,

    how can i define method for an html element, for example:

    element.getElementById(), element.setAttribute ...

    thanks..

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    element.greeting = function()
    {
         alert("hello world");
    }
    or
    Code:
    element.greeting = myFunc;
    function myFunc()
    {
           alert('hello world');
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •