创建动态文本框在IE中不起作用 [英] Creating dynamic textbox not working in IE

查看:43
本文介绍了创建动态文本框在IE中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建动态文本框无法在IE中运行

Creating dynamic textbox not working in IE

// Create a new text input
var newText = document.createElement('input');
newText.type = "input";

推荐答案

输入的类型应为text,因为您将在此处使用此代码创建文本框.
试试这个:
The type of input should be text because you are creating a textbox here with this code.
Try this:
// Create a new text input
var newText = document.createElement('input');
newText.type = "text";
newText.name = "textbox1";
document.forms[0].appendChild(newText);




--Amit




--Amit


此代码在IE中运行良好,可能是阻止了activeX控件或脚本.请在加载页面时检查它.否则,它会正常工作.

this code working well in IE, you may be block activeX control or script.. please check it while loading of page.. otherwise its working fine.

<script>
function myFunction()
{
var btn=document.createElement("input");
var t=document.createTextNode("CLICK ME");
btn.appendChild(t);
document.body.appendChild(btn);
};
</script>


<body>
<p id="demo">Click the button to make a BUTTON element with text.</p>
<button  önclick="myFunction()">Try it</button>
</body>


这篇关于创建动态文本框在IE中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆