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.imooc.com/");
var str="http://www.imooc.com/"
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.imooc.com/");
var str="http://www.imooc.com/"
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()"/>