到后面你们就会理解这一节的重要性了 后面用getElementById()来获取节点的时候就要放在你要获取的节点的后面不然会找不到233333
2016-07-31
也可以写成
<script language="javascript">
document.write("开启JS之旅v");
</script>
<script language="javascript">
document.write("开启JS之旅v");
</script>
2016-07-30
function openWindow(){
openWindow =prompt("是否打开","http://www.imooc.com") ;
if(openWindow=="http://www.imooc.com")
{
window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no')
}
else
{
document.write("好的!");
}
}
openWindow =prompt("是否打开","http://www.imooc.com") ;
if(openWindow=="http://www.imooc.com")
{
window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no')
}
else
{
document.write("好的!");
}
}
function openWindow(){
var mymessage=confirm("是否打开") ;
if(mymessage==true)
{
window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no, status=no,scrollbars=yes')
}
else
{
document.write("好的!");
}
}
var mymessage=confirm("是否打开") ;
if(mymessage==true)
{
window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no, status=no,scrollbars=yes')
}
else
{
document.write("好的!");
}
}
//定义"隐藏内容"的函数
function disp(){
document.getElementById("txt").style.display="none";
}
//定义"显示内容"的函数
function disp2(){
document.getElementById("txt").style.display="block";
}
//定义"取消设置"的函数
function restart(){
if(confirm("是否取消设置")){
document.getElementById("txt").style=""
}
}
function disp(){
document.getElementById("txt").style.display="none";
}
//定义"显示内容"的函数
function disp2(){
document.getElementById("txt").style.display="block";
}
//定义"取消设置"的函数
function restart(){
if(confirm("是否取消设置")){
document.getElementById("txt").style=""
}
}
function delSet(){
var myset=confirm("确定要取消设置???");
if(myset){
var myObj=document.getElementById("txt");
myObj.style.color="";
myObj.style.width="";
myObj.style.height="";
myObj.style.display="block";
}
var myset=confirm("确定要取消设置???");
if(myset){
var myObj=document.getElementById("txt");
myObj.style.color="";
myObj.style.width="";
myObj.style.height="";
myObj.style.display="block";
}
<script type="text/javascript">
document.write("hello");页面输出一行
document.getElementById("p1").style.color="blue";获取页面上id为p1的元素,并把颜色改为blue
</script>
document.write("hello");页面输出一行
document.getElementById("p1").style.color="blue";获取页面上id为p1的元素,并把颜色改为blue
</script>
2016-07-30