javascript - Is it possible to set hyperlink style within a specific DIV only -
i'm making pure javascript webapp (no jquery), generates content in run-time. there no css files loaded, styles generated js.
for example:
function newparagraph(content,x,y,w,h) { var obj = document.createelement("div"); obj.style.position = "absolute"; obj.style.left = x + "px"; obj.style.top = y + "px"; obj.style.width = w + "px"; obj.style.height = h + "px"; obj.style.fontfamily = ..... web font obj.style.fontsize = "20px"; obj.style.fontweight = "normal"; obj.style.fontvariant = "small-caps"; .... etc .... obj.innerhtml = content; return obj; } above function create div object, of specified size , absolute position, set font style , put paragraph content in innerhtml.
this content may contain object.
i know can set hyperlink style in page css. don't want that. want set hyperlink style within scope of specific div object. different div objects have hyperlinks appear in different styles.
is possible, , if so, how?
you can in different way not default should inline.
one way simulate javascript
<a href="/path/file.html" onmouseover="this.style.color='#0f0'" onmouseout="this.style.color='#00f'" >yourlink</a> it possible html. see example 2.3 of w3.org (http://www.w3.org/tr/2002/wd-css-style-attr-20020515)
<a href="http://www.w3.org/" style="{color: #900} :link {background: #ff0} :visited {background: #fff} :hover {outline: thin red solid} :active {background: #00f}">...</a> from info can set style javascript or set onmouse function javascript in method.
Comments
Post a Comment