dom - how to generate a div on the top of the page from javascript after the page is loaded? -


i trying generate div element in corner of screen bookmarklet.

i tried

var newdiv = document.createelement('div'); newdiv.id="blabal"; newdiv.style.background = "#00c"; newdiv.style.border = "4px solid #000"; newdiv.style.width=300; newdiv.style.heigth=200; newdiv.style.position="fixed"; newdiv.style.top="20"; document.body.appendchild(newdiv); 

to avail.

thanks.

you need provide px values, , got typo in heigth:

var newdiv = document.createelement('div'); newdiv.id="blabal"; newdiv.style.background = "#00c"; newdiv.style.border = "4px solid #000"; newdiv.style.width="300px"; newdiv.style.height="200px"; newdiv.style.position="fixed"; newdiv.style.top="20px"; document.body.appendchild(newdiv); 

example: http://jsfiddle.net/niklasvh/gy9xj/


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -