`

html中资源文件共享

    博客分类:
  • html
阅读更多

我在一个html中写入项目中其他页面需要共同引用的资源文件,然后将这个html分别引入其他需要这些资源文件的html。可是,效果出不来,要报错。

source_yun.html的完整代码如下:

<script src="../yun_sour/jquery/jquery-1.11.2.js"></script>
<script src="../yun_sour/jquery/jquery.validate.min.js"></script>
<script src="../yun_sour/jquery/additional-methods.min.js"></script>

 引用source_yun.html的页面test.html的完整代码如下:

test.html:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>test</title>
    <object data="source_yun.html"></object>
</head>
<body>
<input type="text" class="text" value="yun lian">
</body>
</html>
<script>
    $(document).ready(function(){
        alert($(".text").val());
    });
</script>

 打开网页运行,会提示$ is not defined。意思就是,source_yun.html中的资源文件,没有成功引入test.html中。

有没有人知道,要怎么引入才行???

2
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics