anchor问题

cq1981cq 2003-08-19 03:29:16
<script>
var myString="测试"
msgWindow=window.open(" ","displayWindow");
msgWindow.document.writeIn(myString.anchor("anchor_text"));
msgWindow.document.close();
</script>

请问各位高手:在上面的javascript程序中,为什么不能达到跟下面的HTML语句一样的效果:<A NAME="anchor_text">测试</A>呢?要达到这种效果用anchor方法应该怎么做呢?
(其中 anchor_text为URL)
谢谢!
...全文
43 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
cloudchen 2003-08-23
  • 打赏
  • 举报
回复
<button onclick="location.hash='#2'">转到anchor2</button>
<div style="border:1px solid balck;height:400px;">anchor1</div>
<div style="border:1px solid red;height:400px;"><a name="#2">anchor2</a></div>
<div style="border:1px solid green;height:400px;">anchor3</div>
cq1981cq 2003-08-23
  • 打赏
  • 举报
回复
那请问你:
究竟怎么样用location.hash呢?具体一点的源程序是什么?因为我去试了试,还是没有做出来.
cq1981cq 2003-08-23
  • 打赏
  • 举报
回复
那请问你:
究竟怎么样用location.hash呢?具体一点的源程序是什么?因为我去试了试,还是没有做出来.
cloudchen 2003-08-19
  • 打赏
  • 举报
回复
location.hash

87,901

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧