-
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.
-
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?
-
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.
-
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?
-
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.
-
What topics would those be?
-
-
Ok... would be interesting to see how you create this "new" tag. :rolleyes: