您的位置:程序门 -> web 开发 -> javascript



prototype高手请进


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


prototype高手请进[无满意答案结贴,结贴人:aeoluszzf]
发表于:2007-10-09 08:33:24 楼主
使用
getelementsbytagname获得的对象数组在ie6下无法使用prototype的方法进一步操作,ff下可以,求高手解答
发表于:2007-10-09 09:18:511楼 得分:0
html code
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>测试</title> <link href="/css/global.css" rel="stylesheet" type="text/css" /> <link href="/css/layout.css" rel="stylesheet" type="text/css" /> <link href="/css/box.css" rel="stylesheet" type="text/css" /> <link href="/css/widgets.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="/script/prototype.js"></script> <script type="text/javascript"> window.onload = function(){ var lis = document.getelementsbytagname("li"); lis = $a(lis); lis.each(function(li){ li.onclick = function(){ if(li.hasclassname("current")){ alert("current li") } } }) } </script> <style type="text/css"> .current{ font-weight: bold; color: #f60; } </style> </head> <body> <ul><li>测试测试</li><li class="current">测试测试</li><li>测试测试</li><li>测试测试</li></ul> </body> </html>

点击橘红色的字弹出警告框,在ff下工作正常,在ie6下不行
发表于:2007-10-09 09:40:342楼 得分:0
prototype不建议在ie下使用,会有非常严重的内存泄漏问题.   尤其是ajax应用,会导致大量的内存无法释放导致性能爆降.


快速检索

最新资讯
热门点击