var mystr="我是";
var mychar="JavaScript";
document.write(mychar+"<br>");
document.write(mystr+mychar+"的忠實粉絲!");
document.write("<br>");
document.write("我是JavaScript的忠實粉絲!");
var mychar="JavaScript";
document.write(mychar+"<br>");
document.write(mystr+mychar+"的忠實粉絲!");
document.write("<br>");
document.write("我是JavaScript的忠實粉絲!");
2016-06-17
var mymessage=confirm("你是猴子請來的救兵嗎?")
2016-06-17
function m1(){mStyle.color='blue';mStyle.backgroundColor='gray';}
function m2(){mStyle.with='400px';mStyle.height='700px';}
function m3(){mStyle.display='none';}
function m4(){mStyle.display='block';}
function m5(){mConfirm = confirm('取消所有設置?');if(mConfirm==true){mychar.removeAttribute('style');}
}
function m2(){mStyle.with='400px';mStyle.height='700px';}
function m3(){mStyle.display='none';}
function m4(){mStyle.display='block';}
function m5(){mConfirm = confirm('取消所有設置?');if(mConfirm==true){mychar.removeAttribute('style');}
}
現在是反復看了第二遍了.再看評論才知道.document.getELementById() 和document.getELementById().innerHTML document.getELementById().value 是什么意思.什么情況下用. 謝謝~!
2016-06-17
score = prompt("輸入您的成績!") ;
if(score>=90)
{
document.write("你很棒!");
}
else if(score>=75)
{
document.write("不錯吆!");
}
else if(score>=60)
{
document.write("要加油!");
}
else if(score<60&&score>=0)
{
document.write("再努力啊!");
}
else
{
alert("請正確輸入您的成績");
return rec();
}
}
if(score>=90)
{
document.write("你很棒!");
}
else if(score>=75)
{
document.write("不錯吆!");
}
else if(score>=60)
{
document.write("要加油!");
}
else if(score<60&&score>=0)
{
document.write("再努力啊!");
}
else
{
alert("請正確輸入您的成績");
return rec();
}
}
2016-06-16
function openWindow(){
var open=confirm("是否打開?");
if(open==true){
var address=prompt("打開網址:","http://www.xianlaiwan.cn");
if(address!=null){
window.open(address,'_blank','width=400,height=500,menubar=no,toolbar=no');
}
}
}
輸入對話框prompt后面多加了一層if判斷,可以避免在點擊取消按鈕后彈出空網頁!
var open=confirm("是否打開?");
if(open==true){
var address=prompt("打開網址:","http://www.xianlaiwan.cn");
if(address!=null){
window.open(address,'_blank','width=400,height=500,menubar=no,toolbar=no');
}
}
}
輸入對話框prompt后面多加了一層if判斷,可以避免在點擊取消按鈕后彈出空網頁!
<script type="text/javascript">
var mychar=document.getElementById("con");
document.write("原標題:"+mychar.innerHTML+"<br>"); //輸出原h2標簽內容
mychar.innerHTML='Hello world';
document.write("修改后的標題:"+mychar.innerHTML); //輸出修改后h2標簽內容
</script>
var mychar=document.getElementById("con");
document.write("原標題:"+mychar.innerHTML+"<br>"); //輸出原h2標簽內容
mychar.innerHTML='Hello world';
document.write("修改后的標題:"+mychar.innerHTML); //輸出修改后h2標簽內容
</script>
2016-06-16