<script type="text/javascript">
var mychar= document.getElementById("con");
mychar.style.color="red";
mychar.style.backgroundColor="#ccc";
mychar.style.width="300px";
</script>
var mychar= document.getElementById("con");
mychar.style.color="red";
mychar.style.backgroundColor="#ccc";
mychar.style.width="300px";
</script>
2015-05-14
function openwindow(){
var mymessage;
message=prompt("新窗口打开网站")
if(mymessage==true)
{window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no, status=no,scrollbars=yes')}
else
{null}
}
var mymessage;
message=prompt("新窗口打开网站")
if(mymessage==true)
{window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no, status=no,scrollbars=yes')}
else
{null}
}
function add(){
var p1 = document.getElementById("p1");
p1.className="one";
}
function modify(){
var p2 = document.getElementById("p2");
p2.className="two";
}
var p1 = document.getElementById("p1");
p1.className="one";
}
function modify(){
var p2 = document.getElementById("p2");
p2.className="two";
}
2015-05-13
function hidetext()
{
var mychar = document.getElementById("con");
mychar.style.display="none";
}
function showtext()
{
var mychar = document.getElementById("con");
mychar.style.display="block";
}
{
var mychar = document.getElementById("con");
mychar.style.display="none";
}
function showtext()
{
var mychar = document.getElementById("con");
mychar.style.display="block";
}
2015-05-13
var mychar=document.getElementById("con");
mychar.style.color="red";
mychar.style.backgroundColor="#CCC";
mychar.style.width="300px";
mychar.style.color="red";
mychar.style.backgroundColor="#CCC";
mychar.style.width="300px";
2015-05-13
break;
case 1: tdiv.style.width='300px';
tdiv.style.height='300px';
break;
case 2:tdiv.style.display='none';
break;
case 3:tdiv.style.display='block';
break;
case 4:var x=confirm("are you sure quxiao");
if(x){
tdiv.removeAttribute('style');}
break;
}}}}
case 1: tdiv.style.width='300px';
tdiv.style.height='300px';
break;
case 2:tdiv.style.display='none';
break;
case 3:tdiv.style.display='block';
break;
case 4:var x=confirm("are you sure quxiao");
if(x){
tdiv.removeAttribute('style');}
break;
}}}}
window.onload =function(){
var tdiv=document.getElementById('txt');
var bt=document.getElementsByTagName('input');
for(var i=0;i<bt.length;i++)
{
bt[i].index=i;
bt[i].onclick=function (){
switch (this.index){
case 0:
tdiv.style.color='red';
tdiv.style.backgroundColor='yellow';
var tdiv=document.getElementById('txt');
var bt=document.getElementsByTagName('input');
for(var i=0;i<bt.length;i++)
{
bt[i].index=i;
bt[i].onclick=function (){
switch (this.index){
case 0:
tdiv.style.color='red';
tdiv.style.backgroundColor='yellow';
<script type="text/javascript">
function Wopen(){
window.open('http://www.imooc.com','_blank','width=600','height=400','top=100','left=0')
}
</script>
</head>
<body>
<input name="button" type="button" onClick="Wopen()" value="点击我,打开新窗口!" / >
function Wopen(){
window.open('http://www.imooc.com','_blank','width=600','height=400','top=100','left=0')
}
</script>
</head>
<body>
<input name="button" type="button" onClick="Wopen()" value="点击我,打开新窗口!" / >
2015-05-13
最赞回答 / Alyssa_Lee
相对路径例如你的script.js文件是放在一个叫js的文件夹里,js文件夹跟html文件在同一级目录,那么你的script.js的路径就可以写成src="js/script.js"
2015-05-13
function openWindow(){
var conf=confirm('new window?');// 新窗口打开时弹出确认框,是否打开
if (conf){
var addr= prompt('addr ?','http://www.imooc.com/');// 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
window.open(addr,'haha','width=400,height=500,menubar=no,toolbar=no');}
}
var conf=confirm('new window?');// 新窗口打开时弹出确认框,是否打开
if (conf){
var addr= prompt('addr ?','http://www.imooc.com/');// 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
window.open(addr,'haha','width=400,height=500,menubar=no,toolbar=no');}
}
mychar.style.color="red";
mychar.style.backgroundColor="#CCC";
mychar.style.width="300px";
mychar.style.backgroundColor="#CCC";
mychar.style.width="300px";
2015-05-12