<script type="text/javascript">
var mychar= document.getElementById("con");
document.write("结果:"+mychar); //输出获取的P标签。
<p id="con">JavaScript</p>
</script>
这样写不显示任何东西但就是提示过了
吧p放在前面有结果但提示再试一次
var mychar= document.getElementById("con");
document.write("结果:"+mychar); //输出获取的P标签。
<p id="con">JavaScript</p>
</script>
这样写不显示任何东西但就是提示过了
吧p放在前面有结果但提示再试一次
2018-10-11
<script type="text/javascript">
function rec(){
var mymessage=confirm("你喜欢我吗?");
if(mymessage==true)
{document.write("我也喜欢你呀!");}
else
{ document.write("我这么可爱你为什么不喜欢我QwQ"); }
}
</script>
</head>
<body>
<input name="button" type="button" onClick="ren()" value="点我点我"/>
</body>
function rec(){
var mymessage=confirm("你喜欢我吗?");
if(mymessage==true)
{document.write("我也喜欢你呀!");}
else
{ document.write("我这么可爱你为什么不喜欢我QwQ"); }
}
</script>
</head>
<body>
<input name="button" type="button" onClick="ren()" value="点我点我"/>
</body>
2018-09-29
var mychar= document.getElementById("con");
和
var mychar= document.getElementById('con');
只是引号不一样,js应该都能识别,慕课上只能识别双引号
和
var mychar= document.getElementById('con');
只是引号不一样,js应该都能识别,慕课上只能识别双引号
2018-09-28
function add(){
var p1 = document.getElementById("p1");
p1.className:one;
}
function modify(){
var p2 = document.getElementById("p2");
p2.className=two;
}
object.className=className;就会验证通过了,不用加双引号
var p1 = document.getElementById("p1");
p1.className:one;
}
function modify(){
var p2 = document.getElementById("p2");
p2.className=two;
}
object.className=className;就会验证通过了,不用加双引号
2018-09-26