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("這取消");}}
<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;}
//定義"改變顏色"的函數
function aa(){var aaa=document.getElementById("txt");
aaa.style.color="red";}
//定義"改變寬高"的函數
function bb(){var bbb=document.getElementById("txt");
bbb.style.width="400px";}
//定義"隱藏內容"的函數
function cc(){var ccc=document.getElementById("txt");
ccc.style.display="none";}
function aa(){var aaa=document.getElementById("txt");
aaa.style.color="red";}
//定義"改變寬高"的函數
function bb(){var bbb=document.getElementById("txt");
bbb.style.width="400px";}
//定義"隱藏內容"的函數
function cc(){var ccc=document.getElementById("txt");
ccc.style.display="none";}
function openWindow(){
var mydecide=confirm("確定用新窗口打開網站?");// 新窗口打開時彈出確認框,是否打開
if(mydecide==true)
{
var myid=prompt("請輸入網址:","http://www.xianlaiwan.cn");
if(myid!=null)
{
window.open(myid,'_blank','width=400,height=500,menubar=no,status=no')
}
}
大概是這樣吧
var mydecide=confirm("確定用新窗口打開網站?");// 新窗口打開時彈出確認框,是否打開
if(mydecide==true)
{
var myid=prompt("請輸入網址:","http://www.xianlaiwan.cn");
if(myid!=null)
{
window.open(myid,'_blank','width=400,height=500,menubar=no,status=no')
}
}
大概是這樣吧
<script type="text/javascript"></script>
2015-07-05
<script type="text/javascript">
document.write("少年開啟JS之旅!");
</script>
document.write("少年開啟JS之旅!");
</script>
2015-07-03
document.getElementById(“id”)
注:獲取的元素是一個對象,如想對元素進行操作,我們要通過它的屬性或方法。
1.document.getElementById("con")
2.直接輸出獲取的對象,結果為null或[object HTMLParagraphElement]
document.getElementById("con").innerHTML為獲取標簽中的內容。
注:獲取的元素是一個對象,如想對元素進行操作,我們要通過它的屬性或方法。
1.document.getElementById("con")
2.直接輸出獲取的對象,結果為null或[object HTMLParagraphElement]
document.getElementById("con").innerHTML為獲取標簽中的內容。
2015-07-03
function openWindow(){
var mymessage=confirm("你是不是要打開網址?");
if(mymessage==true){
var url;
url = prompt("請輸入你的網址?");
if(url === null){
url = 'www.baidu.com';
}
window.open("http://"+url);
}else{
alert("哦,你原來不是要打開網頁啊");
}
}
大家可以參考一下,我也是小白,加油學習
var mymessage=confirm("你是不是要打開網址?");
if(mymessage==true){
var url;
url = prompt("請輸入你的網址?");
if(url === null){
url = 'www.baidu.com';
}
window.open("http://"+url);
}else{
alert("哦,你原來不是要打開網頁啊");
}
}
大家可以參考一下,我也是小白,加油學習