|
<body>
<center>
<script type="text/javascript">
var name = {name1:"NAME1",name2:"NAME2"};
// var name1 = {name1:'aa',name2:'bb'};
alert(typeof(name));//---在此处输出为object
var person = {name:"student",name2:"hehe"};
alert(typeof(person));
</script>
<input value="name" type="button" onclick="alert(typeof(name))">
<input value="person" type="button" onclick="alert(typeof(person))">
<br/>
<hr>
</center>
</body>
问:为什么直接alert(typeof(name)) --object,而 input onclick时--string
猜测:name与input中的一些地方冲突~~
----那天有确切答案在修改 呵呵 |
|