<HTML>
<HEAD>
<TITLE></TITLE>
<script>
function foo(){
var strText = '<input type="text">'
document.body.insertAdjacentHTML("beforeEnd",strText);
}
</script>
</HEAD>
<BODY>
<input type="button" value="click to add text"; onclick="foo()">
</BODY>
</HTML>
<HEAD>
<TITLE></TITLE>
<script>
function foo(){
var strText = '<input type="text">'
document.body.insertAdjacentHTML("beforeEnd",strText);
}
</script>
</HEAD>
<BODY>
<input type="button" value="click to add text"; onclick="foo()">
</BODY>
</HTML>
解决方案 »
- myeclipse
- js如何区分页面是关闭还是刷新
- 求一种js特效类似flash
- 一个标签同时使用Class和ID,为什么JS中使用document.getElementById获取不到该对象
- 一个简单js问题。。。
- 求教个EXTJS的问题,版本是4.2
- 如果用javascript 动态改变iframe 的src 属性?
- 关于数据处理进度条显示的问题。
- 那位高手指点一下,关于javascript的函数对象的,解决的话送300分,决不食言
- 哪位高人做过办公自动化中的‘留痕’处理,请讲讲思路。
- vml问题:在group中我插入一根线,我如何拖动它
- 求教:用javascript不使用submit按钮,怎么样实现表单传参数的功能?
<HEAD>
<TITLE></TITLE>
<script>
var i = 0;
function foo(){
var oText = document.createElement("input");
oText.type = "text";
oText.id = "text" + i;
oText.value = "text" + i;
oText.style.position = "absolute";
oText.style.top = 30 + i * 30;
document.body.insertAdjacentHTML("beforeEnd",oText.outerHTML);
i++;
}
</script>
</HEAD>
<BODY>
<input type="button" value="click to add text"; onclick="foo()">
</BODY>
</HTML>
<div id="dv"></div>
<button id="btn">添加控件</button>
<script>
function btn.onclick(){
dv.innerHTM="<input type='button' value='this is the new component you add!'>"
}
</script>
)