创建链接
var a = document.createElement("a"); a.href = url; a.innerHTML = text; a.style.color = "red";
创建img对象
var newspan = document.createElement("img");//创建img对象 //设置img对象css样式 newspan.style.position = "absolute"; newspan.style.right=0; newspan.css.Float='right'; newspan.style.right=0; newspan.style.top="31px"; newspan.style.cursor="pointer"; newspan.src = 'http://www.sunhaibing.com/test.gif';
创建TEXTAREA对象
var newTextElement = document.createElement("textarea"); newTextElement.name = pid+"[description]"; newTextElement.rows = 5; newTextElement.cols = 20; document.getElementById(pid).appendChild(newTextElement);
创建input对象
var newElement = document.createElement("input"); newElement.name = pid+"[title]"; newElement.type= "text"; newElement.size= 9; newElement.value= '标题';
创建div
var div = document.createElement("div"); div.innerHTML = "text"; div.className = "myclass";
近期评论