function back(){
var chaos=confirm("are you sure?")
if(chaos==true)
{
onlyyou.removeAttribute("style");}
}
//定义"取消设置"的函数;刚开始用的return,结果死活出不来……
var chaos=confirm("are you sure?")
if(chaos==true)
{
onlyyou.removeAttribute("style");}
}
//定义"取消设置"的函数;刚开始用的return,结果死活出不来……
function shape(){
onlyyou.style.width="800px";onlyyou.style.height="200px" ;}
//定义"改变宽高"的函数
function none(){
onlyyou.style.display="none";}
//定义"隐藏内容"的函数
function block(){
onlyyou.style.display="block";}
//定义"显示内容"的函数
onlyyou.style.width="800px";onlyyou.style.height="200px" ;}
//定义"改变宽高"的函数
function none(){
onlyyou.style.display="none";}
//定义"隐藏内容"的函数
function block(){
onlyyou.style.display="block";}
//定义"显示内容"的函数
var onlyyou = document.getElementById("txt")
function color(){
onlyyou.style.color="red"; color1.style.backgroundColor="blue";}
//定义"改变颜色"的函数
function color(){
onlyyou.style.color="red"; color1.style.backgroundColor="blue";}
//定义"改变颜色"的函数
<input type="button" value="改变颜色" onclick="color()" >
<input type="button" value="改变宽高" onclick="shape()">
<input type="button" value="隐藏内容" onclick="none()">
<input type="button" value="显示内容" onclick="block()">
<input type="button" value="取消设置" onclick="back()">
<input type="button" value="改变宽高" onclick="shape()">
<input type="button" value="隐藏内容" onclick="none()">
<input type="button" value="显示内容" onclick="block()">
<input type="button" value="取消设置" onclick="back()">
已采纳回答 / 宝慕林4266761
最后直接换成取消属性就好了。 if(message==true){myChar.removeAttribute("style");}又及,①myChar=document.getElementById("txt"); 这个不用写5遍,直接在最开头写一次。②reset可能不能用,我之前用return也不行,换个其他词。
2016-03-12
function rec(){
var mymessage=confirm("你确定没有小鸡鸡吗?~");
if(mymessage==true)
{
document.write("你是女士!");
}
else
{
document.write("你是男士!");
}
}
var mymessage=confirm("你确定没有小鸡鸡吗?~");
if(mymessage==true)
{
document.write("你是女士!");
}
else
{
document.write("你是男士!");
}
}
2016-03-12
mychar.style.color="red";
mychar.style.background="grey";
mychar.style.width="300px";
mychar.style.background="grey";
mychar.style.width="300px";
2016-03-12
经过重新写的东西,效果不错,
<script type="text/javascript">
var mychar= document.getElementById("con");
mychar.style.color="red";
mychar.style.backgroundColor="#600030";
mychar.style.fonsize="30";
mychar.style.width="300px";
</script>
<script type="text/javascript">
var mychar= document.getElementById("con");
mychar.style.color="red";
mychar.style.backgroundColor="#600030";
mychar.style.fonsize="30";
mychar.style.width="300px";
</script>
2016-03-11
function openWindow(){
var x=confirm("wanna open it?");
if (x==true)
{var y=prompt("website","http://www.imooc.com/");
if(y!=null)
{window.open(y,'_blank','width=400px,height=500px,menubar=no,toolbar=no');}}}
var x=confirm("wanna open it?");
if (x==true)
{var y=prompt("website","http://www.imooc.com/");
if(y!=null)
{window.open(y,'_blank','width=400px,height=500px,menubar=no,toolbar=no');}}}