最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Prototype setting styles on an element - Stack Overflow

programmeradmin0浏览0评论

Within my prototype class, I have a function called loginSuccess. With in this function I have this bit of code $$('#cartov .overlay-login-display').setStyle({display: 'none'});

What I expected this to do was to hide the div. However, I get this exception: Exception : TypeError: $$("#cartov .overlay-login-display").setStyle is not a function

From everything that I have researched, this is the correct syntax. So I am not sure what I am doing wrong. Any help with this is greatly appreciated.

Within my prototype class, I have a function called loginSuccess. With in this function I have this bit of code $$('#cartov .overlay-login-display').setStyle({display: 'none'});

What I expected this to do was to hide the div. However, I get this exception: Exception : TypeError: $$("#cartov .overlay-login-display").setStyle is not a function

From everything that I have researched, this is the correct syntax. So I am not sure what I am doing wrong. Any help with this is greatly appreciated.

Share Improve this question edited Jun 13, 2011 at 23:37 David Tang 93.7k32 gold badges168 silver badges149 bronze badges asked Jun 13, 2011 at 17:31 rottmanjrottmanj 5311 gold badge9 silver badges21 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

You need to use each()

$$('#cartov .overlay-login-display').each(function(ele) {
  ele.setStyle({display: 'none'})
});
发布评论

评论列表(0)

  1. 暂无评论