0

This is from the Pandora One Source Code Lines 2918-2924 (view-source:http://www.pandora.com/) on Google Chrome

<script id="audioQualityUpsaleTmpl" type="text/x-jquery-tmpl">
    <div class="upsale_container clearfix">
        <h2>Enjoy Higher Quality Audio</h2>

        <p>When Listening on the web, experience music at 192K bits per second. <br/>More bits means
            better sounding Audio.
        </p>

        <div id="audioSample">
            <object width="236" height="35">
                <param value="high" name="quality">
                <param value="transparent" name="wmode">
                <param value="always" name="allowScriptAccess">
                <param value="/static/pandora_one/flash/pandoraone_sampler.swf" name="movie">
                <embed width="236" height="35" allowscriptaccess="always" wmode="transparent"
                       src="/static/pandora_one/flash/pandoraone_sampler.swf">
            </object>
        </div>
        {{tmpl "#upgradeForUpsaleTmpl"}}
    </div>
</script>

Can someone please explain to me what this section of code is designed to do?

Thank you

4

1 回答 1

0

它似乎是 javascript 模板引擎的模板(它似乎是基于 jquery 的,但我不熟悉它)。您可以从 type="text/x-jquery-tmpl" 标记中看出这一点。

模板通常在这样的脚本标记中定义(使用未声明 javascript 的类型标记),因为它们不会在页面加载时由浏览器呈现,但不会作为 javascript 执行。这允许通过 $('#my-template') 之类的方式在客户端选择文本,并将其用作模板。

于 2013-12-02T04:50:45.273 回答