0

我创建了一个通过 html 页面运行的 JQuery 脚本,我现在需要让它从 XML 运行。

在脚本运行的页面开始时,页面看起来像这样。

<div id="main-container">
<div id="container" class="container " style="width: 1906px; height: 953px; margin: 0px auto; visibility: visible;">
<div class="inner" style="background-color: transparent; width: 1906px; height: 953px;">
<div class="second-container overflow-hidden" style="width: 1906px; height: 953px;">
<div class="layer" style="width: 1906px; height: 953px; visibility: hidden; display: block; left: 0px; right: auto; top: 0px; bottom: auto;">
<img class="bg" src="../img/bg.png" style="padding: 0px; border-width: 0px; width: 1906px; height: 953px; margin-left: -953px; margin-top: -476.5px; visibility: visible;">

由此类innersecond-container由jQuery自动创建,即在html本身中你将拥有......

<div id="main-container">

    <div id="container" style="width: 1000px; height: 500px; margin: 0 auto;">

        <div class="layer" style="delay: 1100; animation: all;">

            <img class="bg" src="../img/bg.png" >

所以我所做的如下:

XML:

    <root
    template.root.style="width: 1920px; height: 1080px; margin: 0 auto;">

    <item
        template.item.style="delay: 1100; animation: all;">
        background="images/bg.png"
        imageone="images/test.png"
        imageoneclass="img1-b1"
        template.image1.style="position: absolute; top: 10; left: 300px; direction: left; delay: 10;" />
</root>

JS:

<script type="text/javascript">

    var player = jQuery;

    player.noConflict();

    player(document).ready(function () {

        var body = documnet.getElementsByTagName("body");

        player.ajax({
            type="GET",
            async: "false",
            url: "data.xml",
            dataType: "xml",
            success: function (xml) {

            var container = player('<div id="main-container"></div>).appendTo(body);

            player(xml).find('root').each(function () {

                var root = player('<div id="container"></div>.appendTo(container);
                root.attr('style', player(this).attr('template.root.style'));

                var layer = "player('<div id="layer"></div>.appendTo(root);
                layer.attr('style', player(this).attr('template.item.style'));

            });

我的问题是如何让div类在使用这个原理layer自动生成的内部?div inner

如果有任何错别字或遗漏任何“或”,请再次道歉,因为目前它正在工作,这只是找出我所要求的是否可以完成的情况。

4

0 回答 0