问题1:
// var tjElement=document.createElement("li");
// var idAttribute=tjElement.createAttribute("id");
// idAttribute.value="tj";
// var nameAttribute=tjElement.createAttribute("name");
// nameAttribute.value="tianjin";
tjElement.setAttribute("id","tj");
tjElement.setAttribute("name","tianjin");
——————————————————
为什么前者不行,先创建属性,再给属性赋值。问题2:
document.write输出转移字符的问题?无法输出/n之类的转移字符。问题3:
js中函数显式声明变量//cid,cname是未声明的变量,js中会自动声明。
function viewData(cid,cname){为什么显式声明则会报错?问题4:
Dom对象中方法和属性在文档(js的文档和dom文档都没找到)中查阅不到比如window对象的dialogArguments属性和setData方法?
// var tjElement=document.createElement("li");
// var idAttribute=tjElement.createAttribute("id");
// idAttribute.value="tj";
// var nameAttribute=tjElement.createAttribute("name");
// nameAttribute.value="tianjin";
tjElement.setAttribute("id","tj");
tjElement.setAttribute("name","tianjin");
——————————————————
为什么前者不行,先创建属性,再给属性赋值。问题2:
document.write输出转移字符的问题?无法输出/n之类的转移字符。问题3:
js中函数显式声明变量//cid,cname是未声明的变量,js中会自动声明。
function viewData(cid,cname){为什么显式声明则会报错?问题4:
Dom对象中方法和属性在文档(js的文档和dom文档都没找到)中查阅不到比如window对象的dialogArguments属性和setData方法?
var tjElement=document.createElement("li");
//var idAttribute=tjElement.createAttribute("id");
var idAttribute=document.createAttribute("id");
tjElement.setAttributeNode(idAttribute)
idAttribute.value="tj";
//var nameAttribute=tjElement.createAttribute("name");
var nameAttribute=document.createAttribute("name");
nameAttribute.value="tianjin";
tjElement.setAttributeNode(nameAttribute)2,document.write('\n'),输出再pre标签中才有用,其他标签不会换行,要用br标签
document.write('<pre>1\n2\n3</pre>')
document.write('1\n2\n3')3,人家语法就那样,除非楼主不用js,用就要按照规则4,不同浏览器DOM对象有不同的属性,但是大部分是相同的,看这个:http://www.w3schools.com/jsref/dom_obj_node.asp
谢谢版主大大了,
不过最后那个在你给的链接文档中确实也找不着,(其实自个有个离线版的w3cschool的文档)