document.createElement在chrome浏览器中不能使用 document.createElement在chrome浏览器中不能使用,用什么办法解决呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这么低级的错误google会犯吗? var oo = document.createElement(str); oo.value = textvalue; span.appendChild(oo);createelement和span.appendchild两句都不能用 var str="<input type='text' readonly='readonly' id ='" + oInputFileTextID + "' name='" + oInputFileTextID + "' size=10 >"; <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><script type="text/javascript"> function init(){ var span=document.getElementById("span"); var text=document.createElement("input"); text.type="text"; text.value="test"; span.appendChild(text); } window.onload=init;</script></head><body><span id="span"></span></body></html>貌似不是那么用的 这个没法子,你要动态建立input最好使用框架,ie不支持input修改type和name,但别的浏览器又不支持<input type='text' readonly='readonly' id =...>这样的字符串建立input,只能是document.createElement("input");为了兼容性要写很多代码,最好还是使用框架。 问题出在你的str和span2个变量上,这2个变量的内容是什么?怎么取的值?非IE浏览器要严格按照DOM规范去写。减少兼容性问题 document.createElement标准dom 操作函数。不可能不支持 如果不支持,那么chrome直接不用上市了。所以说错绝对不再chrome身上。 定位错了不是createElement的问题 $(function() { var $input = $("<input type='text' readonly='readonly' id ='" + oInputFileTextID + "' name='" + oInputFileTextID + "' size=10 >"); $('span').append($input);});要这样写,就用框架啊 肯定是传值错误或者大小写错误。chrome的调试器是最好用的,自己去调调吧。肯定是个小问题。你这个标题,是唬谁呢??好搞的孩纸 我顶你个球啊var oo = document.createElement(str);str参数只能是 tagName 啊var oo = document.createElement("input");oo.type = "text";oo.readOnly = true;... 如何通过js或者jquery获得tomcat服务器端的认证对话框? JQ控制DropDownList选中 ExtJS分页问题,大侠们进来看下 请教限制IE浏览器打印次数的问题 ActiveX 认证的问题.. javascript的原型对象指的是什么? 求解答为什么 js老是获取不到值 问大家一个浮动logo的问题 请教,如果我想取得系统日期的下个月份的今天值,可否有比较简单的函数? ActiveXObject生成的word应该怎样选中? 在线文本编辑器实现的问题 WdatePicker.js在ie9无法打开
oo.value = textvalue;
span.appendChild(oo);
createelement和span.appendchild两句都不能用
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function init(){
var span=document.getElementById("span");
var text=document.createElement("input");
text.type="text";
text.value="test";
span.appendChild(text);
}
window.onload=init;
</script>
</head><body>
<span id="span"></span>
</body>
</html>
貌似不是那么用的
为了兼容性要写很多代码,最好还是使用框架。
str
和
span
2个变量上,这2个变量的内容是什么?怎么取的值?非IE浏览器要严格按照DOM规范去写。减少兼容性问题
标准dom 操作函数。不可能不支持
不是createElement的问题
var $input = $("<input type='text' readonly='readonly' id ='" + oInputFileTextID + "' name='" + oInputFileTextID + "' size=10 >");
$('span').append($input);
});要这样写,就用框架啊
你这个标题,是唬谁呢??好搞的孩纸
str参数只能是 tagName 啊
var oo = document.createElement("input");
oo.type = "text";
oo.readOnly = true;
...