SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: new tag

  1. #1
    SitePoint Zealot maileen's Avatar
    Join Date
    Apr 2006
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question new tag

    Hi,

    I would like to create new tags... like :

    <rounddiv width="300px" style='background-color:#A090FF;'> ... </rounddiv>

    when browser will encounter such tag, it should directly use/run a js function which should create such "div".

    how can i do that ?

    thx.
    M.

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You shouldn't have tags that the browser won't understand.

    Instead of the browser "encountering" such a tag, it would be best to create this div you want when the page has finished loading, like this:
    Code:
    window.onload = function() {
      var d = document.createElement('div');
      d.style.width = '300px';
      d.style.backgroundColor = '#A090FF';
      d.appendChild(document.createTextNode('The text you want in the div'));
      document.body.appendChild(d);
    }
    That will put this new div at the end of your document, but you can put it wherever you want using appendChild or insertBefore.

    It's unclear what you mean by the browser "encountering" this tag. What do you mean?

  3. #3
    SitePoint Zealot maileen's Avatar
    Join Date
    Apr 2006
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i mean that when browser read/load html file and find a <div> tag, it knows what it has to do with and how to read the options like width, style, ...

    i would like to have the same with my tags.

  4. #4
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    This in the realm of XML, you would have to add an extra namespace. This wouldn't be very cross-browser. It wouldn't work in internet explorer, for example. What would be better is if you do something like this:
    HTML Code:
    <div class="round">...</div>
    What exactly are you trying to do? How does this "rounddiv" behave?

  5. #5
    SitePoint Zealot maileen's Avatar
    Join Date
    Apr 2006
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In fact, i would like to have some tag which will create some rounded DIV corner, with maybe some border and gradient options.

    I would like to base my work on what i've read about those topics and to make a full and working tag.

    M.

  6. #6
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What topics would those be?

  7. #7
    SitePoint Zealot maileen's Avatar
    Join Date
    Apr 2006
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    round div with border

  8. #8
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok... would be interesting to see how you create this "new" tag.


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
  •