<script type="text/javascript">
function add(){
var p1 = document.getElementById("p1");
p1.className = "one"
}
function modify(){
var p2 = document.getElementById("p2");
p1.className = "two"
}
</script>
双引号里面不需要加点,元素标签里面也不一定要有class
function add(){
var p1 = document.getElementById("p1");
p1.className = "one"
}
function modify(){
var p2 = document.getElementById("p2");
p1.className = "two"
}
</script>
双引号里面不需要加点,元素标签里面也不一定要有class
2016-08-02
function openWindow(){
var buttom=confirm("是否打开?")
if(buttom==true){
var web=prompt("请输入网址");
if(web=="http://www.imooc.com/"){
window.open('http://www.imooc.com/','width=400px,height=500px')
}else{
alert("网址不对!");
}else{
alert("可以退出了!");
}
}
var buttom=confirm("是否打开?")
if(buttom==true){
var web=prompt("请输入网址");
if(web=="http://www.imooc.com/"){
window.open('http://www.imooc.com/','width=400px,height=500px')
}else{
alert("网址不对!");
}else{
alert("可以退出了!");
}
}
mychar.style.color="red";
mychar.style.backgroundColor="#ccc";
mychar.style.width="300px";
mychar.style.fontSize="20px"
mychar.style.backgroundColor="#ccc";
mychar.style.width="300px";
mychar.style.fontSize="20px"
2016-08-01
<script type="text/javascript">
function openWindow()
{
var con=confirm("是否打开慕课网?")
if(con==true)
{
window.open('http://www.imooc.com','_blank','width=400,height=500')
}
else
{
alert('停车做爱枫林晚,霜叶红于守宫砂!')
}
}
function openWindow()
{
var con=confirm("是否打开慕课网?")
if(con==true)
{
window.open('http://www.imooc.com','_blank','width=400,height=500')
}
else
{
alert('停车做爱枫林晚,霜叶红于守宫砂!')
}
}
//定义"显示内容"的函数
function xianShi(){obj.style.display="block";}
//定义"取消设置"的函数
function huiFu(){
if(confirm("确定要取消设置吗?")){
obj.style.color="";
obj.style.backgroundColor="";
obj.style.width="";
obj.style.height="";
obj.style.display="block";
}
}
function xianShi(){obj.style.display="block";}
//定义"取消设置"的函数
function huiFu(){
if(confirm("确定要取消设置吗?")){
obj.style.color="";
obj.style.backgroundColor="";
obj.style.width="";
obj.style.height="";
obj.style.display="block";
}
}
var obj=document.getElementById("txt");
//定义"改变颜色"的函数
function changeColor(){obj.style.color="red";obj.style.backgroundColor="yellow";}
//定义"改变宽高"的函数
function widthAndHeight(){obj.style.width="500";obj.style.height="500";}
//定义"隐藏内容"的函数
function hide(){obj.style.display="none";}
//定义"改变颜色"的函数
function changeColor(){obj.style.color="red";obj.style.backgroundColor="yellow";}
//定义"改变宽高"的函数
function widthAndHeight(){obj.style.width="500";obj.style.height="500";}
//定义"隐藏内容"的函数
function hide(){obj.style.display="none";}
function openWindow(){ var cfi = confirm("是否打开")
if (cfi == true){var pro = prompt("网址")
if(pro == "http://www.imooc.com"){window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no, status=no,scrollbars=yes')}
else{alert("不对!");} }
else{alert("输入错误"); } };
if (cfi == true){var pro = prompt("网址")
if(pro == "http://www.imooc.com"){window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no, status=no,scrollbars=yes')}
else{alert("不对!");} }
else{alert("输入错误"); } };