为什么HTMl里面的JavaScript函数在浏览器里面测试没有显示
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"><html><head><title>ex-4.html...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ex-4.html</title>
<script language="JavaScript">
function student(id,name,url)
this.id1=id
this.name1=name
this.url1=url
this.display=student_display}
function student_display(){
document.writeln("id=“+this["id1"]+"<br>")
document.writeln("name=“+this["name1"]+"<br>")
document.writeln("url=“+this["url1"]+"<br>")
}
MyStudent=new student("000001","林琳",”http://www.buu.com.cn")
MyStudent.display()
</script>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>
<body>
</body>
</html> 展开
<html>
<head>
<title>ex-4.html</title>
<script language="JavaScript">
function student(id,name,url)
this.id1=id
this.name1=name
this.url1=url
this.display=student_display}
function student_display(){
document.writeln("id=“+this["id1"]+"<br>")
document.writeln("name=“+this["name1"]+"<br>")
document.writeln("url=“+this["url1"]+"<br>")
}
MyStudent=new student("000001","林琳",”http://www.buu.com.cn")
MyStudent.display()
</script>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>
<body>
</body>
</html> 展开
2个回答
展开全部
首先,你的Javascript代码每一行的结尾的;(行尾符)都不加;
第二;类开始少了个{;
第三;有一部分标点用了全角.
我帮你改了一下
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ex-4.html</title>
<script language="JavaScript">
function student(id,name,url){
this.id1=id;
this.name1=name;
this.url1=url;
this.display=student_display}
function student_display(){
document.writeln("id="+this["id1"]+"<br>");
document.writeln("name="+this["name1"]+"<br>");
document.writeln("url="+this["url1"]+"<br>");
}
MyStudent=new student("000001","林琳","http://www.buu.com.cn")
MyStudent.display()
</script>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>
<body>
</body>
</html>
第二;类开始少了个{;
第三;有一部分标点用了全角.
我帮你改了一下
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ex-4.html</title>
<script language="JavaScript">
function student(id,name,url){
this.id1=id;
this.name1=name;
this.url1=url;
this.display=student_display}
function student_display(){
document.writeln("id="+this["id1"]+"<br>");
document.writeln("name="+this["name1"]+"<br>");
document.writeln("url="+this["url1"]+"<br>");
}
MyStudent=new student("000001","林琳","http://www.buu.com.cn")
MyStudent.display()
</script>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>
<body>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |