<h2 id="con">I love JavaScript</H2>
<p> JavaScript使网页显示动态效果并实现与用户交互功能。</p>
<script type="text/javascript">
var mychar= document.getElementById("con");
mychar.style.color="red";
mychar.style.backgroundColor="#CCC";
mychar.style.width="300px";
<p> JavaScript使网页显示动态效果并实现与用户交互功能。</p>
<script type="text/javascript">
var mychar= document.getElementById("con");
mychar.style.color="red";
mychar.style.backgroundColor="#CCC";
mychar.style.width="300px";
2018-08-16
<script type="text/javascript">
var mychar=document.getElementById("con") ;
document.write("原标题:"+mychar.innerHTML+"<br>"); //输出原h2标签内容
mychar.innerHTML="Hello world!";
document.write("修改后的标题:"+mychar.innerHTML); //输出修改后h2标签内容
var mychar=document.getElementById("con") ;
document.write("原标题:"+mychar.innerHTML+"<br>"); //输出原h2标签内容
mychar.innerHTML="Hello world!";
document.write("修改后的标题:"+mychar.innerHTML); //输出修改后h2标签内容
2018-08-16
<script type="text/javascript">
function Wopen(){
window.open('http://www.imooc.com','_blank','width=600,height=400,top=100,left=0')
}
</script>
function Wopen(){
window.open('http://www.imooc.com','_blank','width=600,height=400,top=100,left=0')
}
</script>
2018-08-15
function openWindon(){
if(confirm("确定打开新窗口吗?")){
var url = prompt("请输入一个网址","http://www.imooc.com/");
window.open( url,"_blank","toolbar=no, menubar=no, scrollbars=yes, width=400, height=400");
}
}
if(confirm("确定打开新窗口吗?")){
var url = prompt("请输入一个网址","http://www.imooc.com/");
window.open( url,"_blank","toolbar=no, menubar=no, scrollbars=yes, width=400, height=400");
}
}