开发者

Dropdown with prototype.js in IE

开发者 https://www.devze.com 2023-01-08 07:27 出处:网络
I had trouble with this script: http://loki.timon.com.ua/select/ In IE8: all works great开发者_如何学JAVA - dropdowns work, cloned dropdowns work.

I had trouble with this script: http://loki.timon.com.ua/select/

In IE8: all works great开发者_如何学JAVA - dropdowns work, cloned dropdowns work.

In IE7: drop downs dont work.

In IE8 with IE7mode: first dropdown work normally, cloned - not.

People, can you help me?


I have IE7 at work... so for me the script does not work as is... although it does work fine in FF3.5+

When fiddling with it locally... I got it to work by changing the following lines....

<dl class="selectboxs" style="width:74px;" onclick="this.down('dd').toggle()">  

CHANGES TO

<dl class="selectboxs" style="width:74px;" onclick="$(this).down('dd').toggle()">   

Note the $ which is what makes it a prototype object. This is odd since prototype usually wraps elements automatically, but that is what i got..

I also changed the function to add the $() around id.. same reason.. similarly perplexed.

function addMessenger(id)
{
    $(id).insert({after:'<div>' + $(id).innerHTML + '</div>'});
    return false;
}

However I've never used prototype calls from inline js, so maybe something to do with that? Perhaps the JS/prototype experts can help?


Fixed. Just replace

onclick="changeMessengerType(this);"

CHANGES TO

onclick="changeMessengerType($(this));"

And

liselected.update(li.innerHTML);

TO

$(liselected).update(li.innerHTML);

Thanks everyone.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号