最新回答 / 木子舟义
<...code...>你的 message.style.width = 200 + "px"; message.style.height = 200 + "px"; 这两句写错了
2015-12-10
已采纳回答 / 木子舟义
你把mychar 获得元素引用从函数中提出来的话 就得把整个script标签放在你要获取的那个元素后面,因为顺序加载的缘故,像你现在这样放的话,执行 mychar = document.getElement…… 浏览器还没有加载到那个标签,所以mychar的引用为undefined
2015-12-10
function openWindow(){
var message=confirm("是否确认打开新页面?")
if (message=true){
var score=prompt("请输入想要打开的页面","http://www.imooc.com")
if(score!=null){
window.open(score,'_blank','width=400px,height=500px,top=100px,menubar=no,coolbar=no');
}
var message=confirm("是否确认打开新页面?")
if (message=true){
var score=prompt("请输入想要打开的页面","http://www.imooc.com")
if(score!=null){
window.open(score,'_blank','width=400px,height=500px,top=100px,menubar=no,coolbar=no');
}
<script type="text/javascript">
doucument.write("I");
</script>
doucument.write("I");
</script>
2015-12-10
function openWindow(){
var a = confirm("是否开新窗口");
if( a == true){
var b = prompt("确认网址","www.imooc.com");
if (b != null){
window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no');
}
}
}
var a = confirm("是否开新窗口");
if( a == true){
var b = prompt("确认网址","www.imooc.com");
if (b != null){
window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no');
}
}
}
var mychar= document.getElementById("con");
mychar.style.color="red";
mychar.style.background="#CCC";
mychar.style.width="500px";
mychar.style.color="red";
mychar.style.background="#CCC";
mychar.style.width="500px";
2015-12-10