爱问知识人 爱问教育 医院库

帮我看看javascript的location对像,写得哪里不对

首页

帮我看看javascript的location对像,写得哪里不对

Href 设置或返回当前浏览器所载入文档的完整Url 

Host 设置或返回url的宿主和端口。 

Hostname 设置或返回url的宿主,包括主机名或ip地址。 

Port 设置或返回url的端口。 

Portocal 设置或返回url的协议。

Pathname 设置或返回url的路径

Search 设置或返回url的可是那字符串“?”后边的部分

Hash 设置或返回url的无用部分。
这是教程上的定义 可是我执行如下教程中的代码,怎么
和教程上的结果不一样呢?

尤其是点击提交按钮后,更是打不开网页了?
我放到我的网站上的代码及网址如下:
 

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>JavaScript练习</title>
<script language="javascript">
//location对像
document.write(" ef="+location.herf+"<br>")
document.write("location.host="+location.host+"<br>")
document.write("location.hostname="+location.hostname+"<br>")
document.write("location.port="+location.port+"<br>")
document.write("location.portocal="+location.portocal+"<br>")
document.write(" thname="+ thname+"<br>")
document.write(" arch="+ arch+"<br>")
document.write("location.hash="+location.hash+"<br>")
</script>
</head>
 
<body>
<form id="form1" name="form1" method="post" action="">
  <input type="submit" name="Submit" value="提交" onclick="window.location.herf=' ml';" />
  <input type="submit" name="Submit2" value="提交" onclick=" arch='haodd+123';"/>
</form>
</body> 

提交回答
好评回答
  • 2008-02-21 09:26:24
       
     
    JavaScript练习 
     
    //location对像 
    document。write(" ef="+location。herf+"
    ") document。write("location。host="+location。
      host+"
    ") document。write("location。hostname="+location。hostname+"
    ") document。write("location。port="+location。
      port+"
    ") document。write("location。portocal="+location。portocal+"
    ") document。write(" thname="+ thname+"
    ") document。
      
      write(" arch="+ arch+"
    ") document。write("location。hash="+location。hash+"
    ") 2个小错误: input的type要为button而不是submit href拼写错误(herf)。

    p***

    2008-02-21 09:26:24

类似问题

换一换
  • 其他编程语言 相关知识

  • 电脑网络技术
  • 电脑网络

相关推荐

正在加载...
最新资料 推荐信息 热门专题 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 172-191
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):