function myconfirm(){
if(confirm("確定要取消設置嘛?")){
var mychar= document.getElementById("txt");
mychar.style.color="#000";
mychar.style.backgroundColor="#fff";
mychar.style.width="600px";
mychar.style.height="400px";
mychar.style.display="block";}}
if(confirm("確定要取消設置嘛?")){
var mychar= document.getElementById("txt");
mychar.style.color="#000";
mychar.style.backgroundColor="#fff";
mychar.style.width="600px";
mychar.style.height="400px";
mychar.style.display="block";}}
function mywidth(){var mychar= document.getElementById("txt");
mychar.style.width="500px";
mychar.style.height="250px";
function myd(){
var mychar= document.getElementById("txt");
mychar.style.display="none";
}function myb(){
var mychar= document.getElementById("txt");
mychar.style.display="block";}
mychar.style.width="500px";
mychar.style.height="250px";
function myd(){
var mychar= document.getElementById("txt");
mychar.style.display="none";
}function myb(){
var mychar= document.getElementById("txt");
mychar.style.display="block";}
1.function mycolor(){
var mychar= document.getElementById("txt");
mychar.style.color="red";
mychar.style.backgroundColor="#ccc";
}
var mychar= document.getElementById("txt");
mychar.style.color="red";
mychar.style.backgroundColor="#ccc";
}
function hi(){
t.style.display="none";
}//定義"隱藏內容"的函數
function sh(){
t.style.display="block";
}
//定義"顯示內容"的函數
function qx(){
var con=confirm("確定取消嗎?");
if(con==true){
t.removeattribute('style');
}
}//定義"取消設置"的函數
t.style.display="none";
}//定義"隱藏內容"的函數
function sh(){
t.style.display="block";
}
//定義"顯示內容"的函數
function qx(){
var con=confirm("確定取消嗎?");
if(con==true){
t.removeattribute('style');
}
}//定義"取消設置"的函數
<input type="button" value="改變顏色"onclick="col()" >
<input type="button" value="改變寬高"onclick="wh()" >
<input type="button" value="隱藏內容"onclick="hi()" >
<input type="button" value="顯示內容" onclick="sh()" >
<input type="button" value="取消設置"onclick="qx()" >
<input type="button" value="改變寬高"onclick="wh()" >
<input type="button" value="隱藏內容"onclick="hi()" >
<input type="button" value="顯示內容" onclick="sh()" >
<input type="button" value="取消設置"onclick="qx()" >
function openWindow()
{
var message=confirm("是否打開網頁?");
if(message==true)
{
var url=prompt("輸入一個網址:","http://www.xianlaiwan.cn/");
var str="http://www.xianlaiwan.cn/"
if(url == str){
window.open('_blank','width=400,height=500,menubar=no,toolbar=no');
}
else{
alert("error");
}
}
else{
alert("again");
}
}
{
var message=confirm("是否打開網頁?");
if(message==true)
{
var url=prompt("輸入一個網址:","http://www.xianlaiwan.cn/");
var str="http://www.xianlaiwan.cn/"
if(url == str){
window.open('_blank','width=400,height=500,menubar=no,toolbar=no');
}
else{
alert("error");
}
}
else{
alert("again");
}
}
其中最坑的就是隱藏和顯示,函數名要用hidetext()和showtext(),在這里卡了將近半小時
//定義"隱藏內容"的函數
function showtext(){
txt.style.display="block";
}//定義"顯示內容"的函數
function cancel(){
var sure=confirm("確定要取消設置嗎?");
if(sure="true"){
txt.removeAttribute("style");
}
}//定義"取消設置"的函數
//定義"隱藏內容"的函數
function showtext(){
txt.style.display="block";
}//定義"顯示內容"的函數
function cancel(){
var sure=confirm("確定要取消設置嗎?");
if(sure="true"){
txt.removeAttribute("style");
}
}//定義"取消設置"的函數
改變部分1
<input type="button" value="改變顏色" onclick="col()"/>
<input type="button" value="改變寬高" onclick="wid()"/>
<input type="button" value="隱藏內容" onclick="hidetext()"/>
<input type="button" value="顯示內容" onclick="showtext()"/>
<input type="button" value="取消設置" onclick="cancel()"/>
<input type="button" value="改變顏色" onclick="col()"/>
<input type="button" value="改變寬高" onclick="wid()"/>
<input type="button" value="隱藏內容" onclick="hidetext()"/>
<input type="button" value="顯示內容" onclick="showtext()"/>
<input type="button" value="取消設置" onclick="cancel()"/>