【问题标题】:Combining these two HTML + JQuery Scripts pages into one将这两个 HTML + JQuery Scripts 页面合二为一
【发布时间】:2011-07-29 12:38:51
【问题描述】:

背景:

我正在使用 Intuit Web Designs 创建一个网站。在我看来,他们有一个非常奇怪的 HTML 设置,如下所示。 Intuit 允许我添加一个 HTML 框(用于粘贴 HTML 代码)。但是,该网站要求我将 <head></head> 标记中的任何内容粘贴到页面一侧的单独框中。

我正在尝试做的事情: 我有两个功能齐全的 jQuery 脚本——每个都写在单独的文档中。我将一个文档中的 html 上传到 Intuit 内部的 HTML 工具中。然后我将 jQuery 脚本上传到 Intuit 中的特殊标题框中。一切都很完美。

现在是时候添加第二个文档(HTML 和 jQuery)了,因为我希望两个文档都在同一个页面上运行。 html 上传得很好,但是当我将第二个 jQuery 脚本合并到第一个 jQuery 脚本中时,Chrome 控制台开始通知我 JQuery Script #1 缺少文件(不可能,因为它在我添加第二个脚本之前才正常工作!) .所以,总而言之,似乎添加第二个脚本会使事情变得一团糟。

这是我的两个文档(包括完整代码):

文件 #1:

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>



<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>

<script src="jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.pack.js" type="text/javascript"></script>    
<link href="jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css">
<link href="test.css" rel="stylesheet" type="text/css">

<script type="text/javascript">

$(document).ready(function() {

$("#fancyBoxLink").fancybox({
        'transitionIn'  :   'elastic',
        'transitionOut' :   'elastic',
        'speedIn'       :   700,
        'speedOut'      :   200, 
        'overlayShow'   :   false           
});

});     


</script>

</head>

<body>

<center>
<p>
You can
<a href="#div_table" id="fancyBoxLink">Click here to see our various things</a>
</p>
</center>

<div style="display:none" > 
<div id="div_table">

<table id="payment_options" summary="Payment Plans">
<colgroup>
<col class="poptions-odd">
<col class="poptions-even">
<col class="poptions-odd">
<col class="poptions-even"> 
    </colgroup>
<thead>
<tr>
<th scope="col" id="poptions-features">Features</th>
<th scope="col" id="poptions-startup">Startup</th>
<th scope="col" id="poptions-value">Standard</th>
<th scope="col" id="poptions-premium">Premium</th>
</tr>
</thead>
<tbody>
<tr>
<td>Plan one</td>
<td>2</td>
<td>5</td>
<td>Unlimited</td>
</tr>

</tbody>
</table>
</div>
</div>

</body>

</html>

文件 #2:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>

<title>{ visibility: inherit; } The Fancybox Photo Gallery Demo #1</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="fancybox.js"></script>

<link href="images/fancybox.css" rel="stylesheet" type="text/css"> 
<link href="../photoGallery.css" rel="stylesheet" type="text/css">

<script type="text/javascript">

$('html').addClass('js-on');
/* Fire Fancybox */
$(document).ready(function() {
    $("a").fancybox({
    'titleFormat':function(itemTitle, itemArray, itemIndex, itemOpts) {
                  return itemTitle + '<span> Image ' + (itemIndex + 1) + ' of ' + itemArray.length + '</span>';
                }
    });
}); 
</script>

</head>

<body>

<h1>Prote(C#)tion Photo Gallery</h1>

<div id="gallery">
<a href="../SlideShow/mainPage.png" rel="gallery" title="Authentication Page."><img src="../SlideShow/mainPage.png" alt="" id="first"><span></span></a>
<a href="../SlideShow/importSettings.png" rel="gallery" title="Import any previously saved settings."><img src="../SlideShow/importSettings.png" alt=""></a>

</div>

</body>

</html>

我对专家的最后一个问题!: 如何合并文档 1 和文档 2 的两个标题?这些标题脚本需要以某种方式组合,我相信这就是我的问题所在。

【问题讨论】:

    标签: jquery html intuit


    【解决方案1】:

    在查看您的 html 时,Web 服务器文件系统中的两个文件的位置似乎不同。例如,fancybox.js 在第二个 html 中直接引用,而在第一个 html 中它应该是版本化的并且位于不同的位置。为什么不显示结果html,你组合的html?

    【讨论】:

    • @Teasung 我的组合代码只是所有标题代码放在一起。不过,我删除了所有重复项,例如 Google API。
    猜你喜欢
    • 2016-12-28
    • 2016-02-08
    • 1970-01-01
    • 2015-01-23
    • 1970-01-01
    • 2014-08-02
    • 2020-08-17
    • 2011-12-11
    • 1970-01-01
    相关资源
    最近更新 更多