ms ie bug?

aotianlong 2007-01-25 02:00:01
<script language="javascript" src="d:\workspace\rails\things\public\javascripts\prototype.js"></script>
<p><textarea id="div">content</textarea></p>
<script language="javascript">
new Insertion.Before($("div"),"<div>sdfasdf</div>");
</script>

this will not work


<script language="javascript" src="d:\workspace\rails\things\public\javascripts\prototype.js"></script>
textarea id="div">content</textarea>
<script language="javascript">
new Insertion.Before($("div"),"<div>sdfasdf</div>");
</script>


this code will work!!!!

花费我太多时间了!简直是浪费我自己的时间,哎!



有没有人能解决这个问题?
...全文
172 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
tjgjp 2007-01-25
  • 打赏
  • 举报
回复
Anewczs(Anew) 说的对。最好用相对路径。
比如 test.html需要使用prototype.js,如果test.html和prototype.js在同一文件夹下,你可以这样用 :
<script language="javascript" src="prototype.js"></script>
如果不在同一文件夹下,都要相对于test.html的路径来写。
<script language="javascript" src="js/prototype.js"></script>
js文件夹和test.html同以目录
曹志士 2007-01-25
  • 打赏
  • 举报
回复
还不明白?

d:\\workspace\\rails\\things\\public\\javascripts\\prototype.js

最好写相对地址
曹志士 2007-01-25
  • 打赏
  • 举报
回复
哈哈
这个src一看就不顺眼
haothing 2007-01-25
  • 打赏
  • 举报
回复
d:\workspace\rails\things\public\javascripts\prototype.js中的\换成/
aotianlong 2007-01-25
  • 打赏
  • 举报
回复
Prototype Insertion, IE 6, tr’s, and “invalid target element for this operation…”

After much hardship I’m giving up on trying to use Prototype’s Insertion function for inserting new rows after a specified target row. Everything I try works in Firefox but blows out in IE 6, which is the “supported platform”. After some searching it seems IE has inconsistent support for the insertAdjacentHTML method, and apparently for elements like TR and TBODY IE will throw an exception if the method is called on those methods. In the latest prerelease there is a fix for tbodys, but nothing for tr, and my knowledge of dom manipulation fell short when trying to hack that in. If anyone can see how to add that to prototype.js, please let me know. This seems like something that would be commonly done with Rails apps for dynamically adding rows to a table, so its curious that I couldn’t find anything via Google…


google到了一篇文章
aotianlong 2007-01-25
  • 打赏
  • 举报
回复
<script src="http://localhost:3000/javascripts/prototype.js?1169646436" type="text/javascript"></script>
<body>
<textarea id="area"></textarea>
<script>
document.getElementById("area").insertAdjacentHTML("beforeBegin","<div>ssssssssss</div>");
new Insertion.Top("area","<div>ssssssssss</div>");
</script>
</body>

似乎是prototype.js的问题,因该以上两语句是等效的。

但是后者却出错了。
aotianlong 2007-01-25
  • 打赏
  • 举报
回复
这个不是主要问题

我说的是 ie 的 element.insertAdjacentHtml方法为什么老出错

报告: 操作的原始 HTML 无效
或者报告 未知错误


我的是IE6

87,904

社区成员

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

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