//定義"改變顏色"的函數
function color(){
var txt=document.getElementById("txt");
txt.style.color="red";
txt.style.backgroundColor="#ccc";
};
//定義"改變寬高"的函數
function wh(){
var txt=document.getElementById("txt");
txt.style.width="300px";
txt.style.height="400px";
};
function color(){
var txt=document.getElementById("txt");
txt.style.color="red";
txt.style.backgroundColor="#ccc";
};
//定義"改變寬高"的函數
function wh(){
var txt=document.getElementById("txt");
txt.style.width="300px";
txt.style.height="400px";
};
function lq(){
var lqq;
lqq = prompt("你對此游戲的評價是多少?(0~100分)");
if(lqq>=100){
document.write("非常給力!");
}
else if(lqq>=60){
document.write("還不錯~!");
}
else{
document.write("oh~希望不會影響到您~如果影響到了就跟我們嘿嘿嘿,如果沒有影響到您,您就和他嘿嘿嘿");
}
}
var lqq;
lqq = prompt("你對此游戲的評價是多少?(0~100分)");
if(lqq>=100){
document.write("非常給力!");
}
else if(lqq>=60){
document.write("還不錯~!");
}
else{
document.write("oh~希望不會影響到您~如果影響到了就跟我們嘿嘿嘿,如果沒有影響到您,您就和他嘿嘿嘿");
}
}
2016-05-15
var mystr="我是";
var mychar="JavaScript";
document.write("<br/>")
document.write(mystr+mychar+"的忠誠粉絲")
var mychar="JavaScript";
document.write("<br/>")
document.write(mystr+mychar+"的忠誠粉絲")
2016-05-15
<script type="text/javascript">
function contxt() //定義函數
{
alert("哈哈,調用函數了!");
}
contxt();//函數調用
</script>
</head>
<body>
<form>
<input type="button" value="點擊我" onclick="contxt();" /> <!--onclick="這里輸入函數名"-->
</form>
</body>
function contxt() //定義函數
{
alert("哈哈,調用函數了!");
}
contxt();//函數調用
</script>
</head>
<body>
<form>
<input type="button" value="點擊我" onclick="contxt();" /> <!--onclick="這里輸入函數名"-->
</form>
</body>
2016-05-15
<script type="text/javascript">
var score =80; //score變量存儲成績,初值為80
if (score>=60) //判斷是否大于60則顯示及格
{
document.write("很棒,成績及格了。");
}
else //判斷是否小于60則顯示不及格
{
document.write("加油,成績不及格。");
}
</script>
var score =80; //score變量存儲成績,初值為80
if (score>=60) //判斷是否大于60則顯示及格
{
document.write("很棒,成績及格了。");
}
else //判斷是否小于60則顯示不及格
{
document.write("加油,成績不及格。");
}
</script>
2016-05-15
在不知道removeAttribute的情況下,找到了這個
var message=confirm("確定取消設置嗎?");
if(message)
{var mychar=document.getElementById("txt");
mychar.style.color="";
mychar.style.backgroundColor="";
mychar.style.width="";
mychar.style.height="";
mychar.style.display="block";
}
var message=confirm("確定取消設置嗎?");
if(message)
{var mychar=document.getElementById("txt");
mychar.style.color="";
mychar.style.backgroundColor="";
mychar.style.width="";
mychar.style.height="";
mychar.style.display="block";
}