如何获取

发布于 2024-11-27 12:23:37 字数 1816 浏览 0 评论 0原文

目前唯一可访问的 ID 是“dialog1”。有了这些信息,我如何向下遍历以获取

我刚刚意识到我必须使用 Mootools 来完成此操作,因为脚本的其余部分是在其中编写的。我对 Mootools 完全陌生,你'

$('#dialog1').children('NOLOCALIZATION').children('object').attr('classid');似乎对我有用。我实际上正在使用 MooTools。我如何使用这个 jQuery 而不发生冲突?

<ul>
<li>
    <a href="#dialog1" rel="vidbox" title="video">watch video</a>

</li>
</ul>

<div id="dialog1" class="window dialog" style="width: 806px; height:504px;">
    <NOLOCALIZATION>
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="806" height="504" id="http://www.youtube.com/watch?v=uhi5x7V3WXE">
        <param name="wmode" value="transparent" />
        <param name="movie" value="http://www.youtube.com/watch?v=uhi5x7V3WXE" />
        <param name="allowFullScreen" value="true" />
        <param name="allowscriptaccess" value="always" />
        <param name="FlashVars" value="width=806&height=504&dart_zone_url=&cms_id=AllBusiness&content_id=16009601&auto_start=1&auto_mute=1&playPreroll=0&playtremor=0"/>
    <object type="application/x-shockwave-flash" width="806" height="504" data="http://www.youtube.com/watch?v=uhi5x7V3WXE">
        <param name="wmode" value="transparent" />
        <param name="movie" value="http://www.youtube.com/watch?v=uhi5x7V3WXE" />
        <param name="allowFullScreen" value="true" />
        <param name="allowscriptaccess" value="always" />
        <param name="FlashVars" value="width=806&height=504&dart_zone_url=&auto_start=1&auto_mute=1&playPreroll=0&playtremor=0"/>
    </object>
    </object>
</NOLOCALIZATION>
</div>

Only accessible id right now is "dialog1". Given that information how do I traverse down to get the <object classid>?

I just realised that i've to do this with Mootools as the rest of the script is written in it. I'm completely new to Mootools thou'

$('#dialog1').children('NOLOCALIZATION').children('object').attr('classid'); seems to work for me. I'm actually using MooTools. How do I use this jQuery without conflicting?

<ul>
<li>
    <a href="#dialog1" rel="vidbox" title="video">watch video</a>

</li>
</ul>

<div id="dialog1" class="window dialog" style="width: 806px; height:504px;">
    <NOLOCALIZATION>
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="806" height="504" id="http://www.youtube.com/watch?v=uhi5x7V3WXE">
        <param name="wmode" value="transparent" />
        <param name="movie" value="http://www.youtube.com/watch?v=uhi5x7V3WXE" />
        <param name="allowFullScreen" value="true" />
        <param name="allowscriptaccess" value="always" />
        <param name="FlashVars" value="width=806&height=504&dart_zone_url=&cms_id=AllBusiness&content_id=16009601&auto_start=1&auto_mute=1&playPreroll=0&playtremor=0"/>
    <object type="application/x-shockwave-flash" width="806" height="504" data="http://www.youtube.com/watch?v=uhi5x7V3WXE">
        <param name="wmode" value="transparent" />
        <param name="movie" value="http://www.youtube.com/watch?v=uhi5x7V3WXE" />
        <param name="allowFullScreen" value="true" />
        <param name="allowscriptaccess" value="always" />
        <param name="FlashVars" value="width=806&height=504&dart_zone_url=&auto_start=1&auto_mute=1&playPreroll=0&playtremor=0"/>
    </object>
    </object>
</NOLOCALIZATION>
</div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无声无音无过去 2024-12-04 12:23:37
var classid = $('#dialog1 object').first().attr('classid');

或者我想:

$('#dialog1 object:not(object object)')

或者

$('#dialog1 > nolocalization > object')

虽然我不确定浏览器如何处理 元素。

在您评论需要动态版本之后:

$(dialog).find('object').first().attr('classid');

虽然实际上您只需要通读 jQuery API 并发挥创意你的选择器。测试一下;看看什么有效;看看什么没有。

var classid = $('#dialog1 object').first().attr('classid');

or i suppose:

$('#dialog1 object:not(object object)')

or

$('#dialog1 > nolocalization > object')

although I'm not sure how the browser handles a <NOLOCALIZATION> element.

After your comment about needing a dynamic version:

$(dialog).find('object').first().attr('classid');

Although really you just need to read through the jQuery API and be creative with your selectors. Test things out; see what works; see what doesn't.

等待圉鍢 2024-12-04 12:23:37

对于mootools:

document.getElements("a[rel=vidbox]").addEvents({
    click: function(e) {
        e.stop();

        var div = this.get("href").replace("#", "");
        var obj = $(div).getElement("object");

        // object may not be extended so normal getAttribute.
        var attr = obj.getAttribute("classid");
        alert(attr);
    }
});

http://jsfiddle.net/dimitar/XUyDU/

请注意,在 IE6-IE8 中, mootools 不会扩展 OBJECT 元素,因此 obj 将不会具有其他可用的 .get() 或 mootools 添加的任何其他 Element.proto。

for mootools:

document.getElements("a[rel=vidbox]").addEvents({
    click: function(e) {
        e.stop();

        var div = this.get("href").replace("#", "");
        var obj = $(div).getElement("object");

        // object may not be extended so normal getAttribute.
        var attr = obj.getAttribute("classid");
        alert(attr);
    }
});

http://jsfiddle.net/dimitar/XUyDU/

notice that in IE6-IE8, mootools does NOT extend the OBJECT element, hence obj will NOT have the otherwise available .get() or any other Element.proto that mootools adds.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文