<script type="text/javascript"></script>
2015-07-07
<script type="text/javascript">
var score=80;
if(score>=60);
{document.write("恭喜你,及格了")};
else
{document.write("抱歉,没及格")};
</script>
var score=80;
if(score>=60);
{document.write("恭喜你,及格了")};
else
{document.write("抱歉,没及格")};
</script>
2015-07-07
已采纳回答 / arlenhui
因为html是自上而下的语言,而JavaScript解析时没有window.onload=function(){}包裹住,所以函数在html结构树还没有生成就开始解析了
2015-07-07
if(score>=90)
{
document.write("你很棒!");
}
else if(score>=75)
{
document.write("不错吆!");
}
这个我知道是分数大于等于90时,点击确定是出现的内容。
else if(score>=75)
{
document.write("不错吆!");
}
但是这段代码几个 else 是什么意思?有点懵了??、求教?
{
document.write("你很棒!");
}
else if(score>=75)
{
document.write("不错吆!");
}
这个我知道是分数大于等于90时,点击确定是出现的内容。
else if(score>=75)
{
document.write("不错吆!");
}
但是这段代码几个 else 是什么意思?有点懵了??、求教?
2015-07-06
function openWindow(){
var c=confirm("确定打开新窗口");
if(c==true){
var d=prompt('输网址,www.xx.com,只输入xx','cdtjcn');
if(d==""){
alert("www.cdtjcn.com");
window.open("http://www.cdtjcn.com","_blank");
}else{
alert("骚等,打开w."+d+".cm");
window.open("http://www."+d+".com","_blank");
}}else{alert("这取消");}}
var c=confirm("确定打开新窗口");
if(c==true){
var d=prompt('输网址,www.xx.com,只输入xx','cdtjcn');
if(d==""){
alert("www.cdtjcn.com");
window.open("http://www.cdtjcn.com","_blank");
}else{
alert("骚等,打开w."+d+".cm");
window.open("http://www."+d+".com","_blank");
}}else{alert("这取消");}}
最赞回答 / Perona
31行<...code...>这里的函数名换个名字,函数名不要取JS的关键字,下面50行定义的函数名也要更改。50行<...code...>66行<...code...>这里变量名写错了,前面定义的是origin,这里却成了orgin。修改后的代码<...code...>
2015-07-06
<script type="text/javascript">
var mystr="我是";
var mychar="JavaScript";
document.write(mystr+"<br>");
document.write("我是JavaScript的忠实粉丝!")
</script>
var mystr="我是";
var mychar="JavaScript";
document.write(mystr+"<br>");
document.write("我是JavaScript的忠实粉丝!")
</script>
2015-07-06
//定义"显示内容"的函数
function dd(){var ddd=document.getElementById("txt");
ddd.style.display="block";}
//定义"取消设置"的函数
function ee()
{
var eee=confirm("你确定要取消设置吗?")
if (eee=true)
{document.getElementById("txt").removeAttribute('style');}
}
else{return=null;}
function dd(){var ddd=document.getElementById("txt");
ddd.style.display="block";}
//定义"取消设置"的函数
function ee()
{
var eee=confirm("你确定要取消设置吗?")
if (eee=true)
{document.getElementById("txt").removeAttribute('style');}
}
else{return=null;}