已采纳回答 / 陪着你一直到世界尽头
那么把这个js脚本放head里面还是body里面呢? 答案是不仅要放到body里面,而且还得放到定义id='vSort0'的列表框后面,因为这个js脚本中有document.form4.vSort0.selectedIndex,如果放到head里或者body的id='vSort0'前,页面加载后顺序执行代码,执行到这个js发现vSort0未定义(即undefind),这个js也就失去了作用。 而为什么我们经常看到有很多的人把js脚本放到head里面没事呢?对! 就是因为你看到的在head里的js代码有on...
2016-04-11
<script type="text/javascript">
function add(){
var p1 = document.getElementById("p1");
p1.className = "one";
}
function modify(){
var p2 = document.getElementById("p2");
p2.className = "two";
}
</script>
function add(){
var p1 = document.getElementById("p1");
p1.className = "one";
}
function modify(){
var p2 = document.getElementById("p2");
p2.className = "two";
}
</script>
2016-04-11
<script type="text/javascript">
function hidetext()
{
var mychar = document.getElementById("con");
mychar.style.display = "none";
}
function showtext()
{
var mychar = document.getElementById("con");
mychar.style.display = "block";
}
</script>
function hidetext()
{
var mychar = document.getElementById("con");
mychar.style.display = "none";
}
function showtext()
{
var mychar = document.getElementById("con");
mychar.style.display = "block";
}
</script>
2016-04-11
<script type="text/javascript">
function add(){
var p1 = document.getElementById("p1");
p1.className="one";
}
function modify(){
var p2 = document.getElementById("p2");
p2.className="two";
}
</script>
function add(){
var p1 = document.getElementById("p1");
p1.className="one";
}
function modify(){
var p2 = document.getElementById("p2");
p2.className="two";
}
</script>
2016-04-11
<script type="text/javascript">
function hidetext()
{
var mychar = document.getElementById("con");
mychar.style.display=("none");
}
function showtext()
{
var mychar = document.getElementById("con");
mychar.style.display=("block");
}
</script>
function hidetext()
{
var mychar = document.getElementById("con");
mychar.style.display=("none");
}
function showtext()
{
var mychar = document.getElementById("con");
mychar.style.display=("block");
}
</script>
2016-04-11
function openWindow(){
var ifnew = confirm("是否打开新窗口");
if(ifnew){
var url = prompt("请输入网址","http://www.imooc.com");
if(url!=null){
window.open(url,"_blank","width=400,height=500,menubar=no,toolbar=no");
}
}
}
var ifnew = confirm("是否打开新窗口");
if(ifnew){
var url = prompt("请输入网址","http://www.imooc.com");
if(url!=null){
window.open(url,"_blank","width=400,height=500,menubar=no,toolbar=no");
}
}
}
已采纳回答 / 麦麦不爱卖萌
你 function openWindow(){ var open=confirm("是否新建?");// 新窗口打开时弹出确认框,是否打开 }的反括号打错地方了兄弟,<html> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <script t...
2016-04-10
已采纳回答 / 儒雅的方方
可以的,window.open('URL','name','_blank')name:一个可选的字符串,该字符串是一个由逗号分隔的特征列表,其中包括数字、字母和下划线,该字符声明了新窗口的名称。这个名称可以用作标记 <a> 和 <form> 的属性 target 的值。如果该参数指定了一个已经存在的窗口,那么 open() 方法就不再创建一个新窗口,而只是返回对指定窗口的引用。
2016-04-10
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb18030">
<title>插入js代码</title>
<script type="text/javascript">
document.write("开启JS之旅!");
</script>
</head>
<body>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb18030">
<title>插入js代码</title>
<script type="text/javascript">
document.write("开启JS之旅!");
</script>
</head>
<body>
</body>
</html>
2016-04-10