var myObj=document.getElementById("con");
//定義"改變顏色"的函數
function change_color(){
myObj.style.color="green";
myObj.style.backgroundColor="red";
}
//定義"改變顏色"的函數
function change_color(){
myObj.style.color="green";
myObj.style.backgroundColor="red";
}
以下是我的設置,已經試了,沒有問題;我反來發,可以從上到下看。input的onclick名字再分別設一下就行了。大家繼續加油了
<script type="text/javascript">
var settxt=document.getElementById("txt");
//定義"改變顏色"的函數
function change_color(){
settxt.style.color="red";
settxt.style.backgroundColor="orange";
}
<script type="text/javascript">
var settxt=document.getElementById("txt");
//定義"改變顏色"的函數
function change_color(){
settxt.style.color="red";
settxt.style.backgroundColor="orange";
}
//定義"改變寬高"的函數
function change_size(){
settxt.style.width="300px";
settxt.style.height="400px";
}
//定義"隱藏內容"的函數
function hidden_txt(){
settxt.style.display="none";
}
//定義"顯示內容"的函數
function display_txt(){
settxt.style.display="block";
}
function change_size(){
settxt.style.width="300px";
settxt.style.height="400px";
}
//定義"隱藏內容"的函數
function hidden_txt(){
settxt.style.display="none";
}
//定義"顯示內容"的函數
function display_txt(){
settxt.style.display="block";
}
<script type="text/javascript">
var mywin=window.open("www.");
mywin.close();
</script>
var mywin=window.open("www.");
mywin.close();
</script>
2015-11-21
關閉新打開的窗口:
<script type="text/javascript">
var mywin=window.open("http://www..com");
mywin.close();
</script>
<script type="text/javascript">
var mywin=window.open("http://www..com");
mywin.close();
</script>
2015-11-21
<script type="text/javascript">
// document.write("開啟JS之旅!I will be success!");
</script>
</head>
<body>
<p id="p1">開啟JS之旅,I will be success!</p>
<script>
document.getElementById("p1").style.color="red";
</script>
中間加的代碼,貼出來,剛開始學習js
// document.write("開啟JS之旅!I will be success!");
</script>
</head>
<body>
<p id="p1">開啟JS之旅,I will be success!</p>
<script>
document.getElementById("p1").style.color="red";
</script>
中間加的代碼,貼出來,剛開始學習js
2015-11-20
function openWindow(){
var wopen=confirm('是否跳轉?');
// 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
if(wopen==true){
var web = window.prompt('請輸入網址','http://www.xianlaiwan.cn');
var mywindow = window.open(web,'_blank','width=400,height=500,menubar=no,toolbar=no');
}
}
var wopen=confirm('是否跳轉?');
// 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
if(wopen==true){
var web = window.prompt('請輸入網址','http://www.xianlaiwan.cn');
var mywindow = window.open(web,'_blank','width=400,height=500,menubar=no,toolbar=no');
}
}