开发者

Grabbing the class on an iframe

I am able to grab the id from an iframe with this

var iFrame = window.top.document.getElementById('window_&开发者_开发百科lt;?php echo $_product->getId() ?>_content');

however I can not figure out how to grab the class of that iframe. The prototype library is loaded on the site as well but I do not know how to make the $ selector grab something from window.top

The reason I have to do this is because the id is generated in two different ways from the site and will not work for my purposes.

I started playing around with

var iFrame = window.top.document.getElementsByClassName('theIframe');

but it is not working for me yet...

Any ideas on how I can grab the class name of the iFrame? How can I reach to top with prototype selector?


This will return the class:

window.top.document.getElementById('window_<?php echo $_product->getId() ?>_content').className

If you are storing the iframe element in a variable anyway, you can use:

iFrame.className
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜