function cancer(){
if(confirm("come on!!! dragon")){
var txt5 = document.getElementById("txt");
txt5.style.color="#000";
txt5.style.backgroundColor="#fff";
txt5.style.width="600px";
txt5.style.height="400px";
txt5.style.display="block";
}
}
if(confirm("come on!!! dragon")){
var txt5 = document.getElementById("txt");
txt5.style.color="#000";
txt5.style.backgroundColor="#fff";
txt5.style.width="600px";
txt5.style.height="400px";
txt5.style.display="block";
}
}
<script language="javascript"></script>這個玩意可以簡稱=======<script></script>!!!!!!!!!!!
2015-07-11
顯示和隱藏
object.style.display="value"
value取none和block(塊狀元素)
object.style.display="value"
value取none和block(塊狀元素)
2015-07-10
定義"取消設置"的函數
oBtn5.onclick=function(){
var mymessage= confirm("是否取消設置") ;
if(mymessage==true)
{
oTxt.style.color="#333";
oTxt.style.backgroundColor="#fff";
oTxt.style.width="600px";
oTxt.style.height="400px";
oTxt.style.display="block";
}
oBtn5.onclick=function(){
var mymessage= confirm("是否取消設置") ;
if(mymessage==true)
{
oTxt.style.color="#333";
oTxt.style.backgroundColor="#fff";
oTxt.style.width="600px";
oTxt.style.height="400px";
oTxt.style.display="block";
}
第一次見到這樣的方式教學 雖然有些太簡單 但跟玩游戲一樣 另外這個代碼編輯器的渲染效果真好看 就都做完吧
2015-07-10
var mychar= document.getElementById("con");
mychar.style.color='red';
mychar.style.backgroundColor='#ccc';
mychar.style.width="300px";
直接用background也能改
mychar.style.color='red';
mychar.style.backgroundColor='#ccc';
mychar.style.width="300px";
直接用background也能改
2015-07-10
<script type="text/javascript">
var mychar= document.getElementById("con");
mychar.style.color = "red";
mychar.style.backgroundColor = "#CCC";
mychar.style.width = "300px";
</script>
var mychar= document.getElementById("con");
mychar.style.color = "red";
mychar.style.backgroundColor = "#CCC";
mychar.style.width = "300px";
</script>
2015-07-10
var mychar= document.getElementById("con");
document.write("原標題:"+mychar.innerHTML+"<br>"); //輸出原h2標簽內容
mychar.innerHTML = "Hello World!";
document.write("修改后的標題:"+mychar.innerHTML); //輸出修改后h2標簽內容
document.write("原標題:"+mychar.innerHTML+"<br>"); //輸出原h2標簽內容
mychar.innerHTML = "Hello World!";
document.write("修改后的標題:"+mychar.innerHTML); //輸出修改后h2標簽內容
2015-07-10
//定義"取消設置"的函數
function canle(){
if(confirm("是否取消設置")){
var canleALL = document.getElementById("txt");
canleALL.style.color="#000";
canleALL.style.backgroundColor="#fff";
canleALL.style.width="600px";
canleALL.style.height="400px";
canleALL.style.display="block";
}
}
function canle(){
if(confirm("是否取消設置")){
var canleALL = document.getElementById("txt");
canleALL.style.color="#000";
canleALL.style.backgroundColor="#fff";
canleALL.style.width="600px";
canleALL.style.height="400px";
canleALL.style.display="block";
}
}
記得以前看書用的是<script language="javascript"></script>
剛才查了下 好像說這種已經廢棄了
現在常用的是type="text/javascript"
剛才查了下 好像說這種已經廢棄了
現在常用的是type="text/javascript"
2015-07-09