A文档载入B文档的内容,并且通过JQ操作被引入到A文档中的元素

A文档 (index.html):

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<link href="css/bootstrap.css" rel="stylesheet">
</head>
<body>
<div id="textDiv"> </div>
<script src="js/jquery-2.1.4.min.js"></script>
<script src="js/bootstrap.js"></script>
<script>
$('#textDiv').load('modal.html',function(){
$('#modalBox').modal('show');
}); </script>
</body>
</html>

B文档(modal.html):

<div class="modal fade" id="modalBox" role="dialog" aria-labelledby="conTitle">
<div class="modal-dialog" role="document" >
<div class="modal-content">
<div class="modal-header" style="background-color: #fff;border-top-left-radius: 15px;border-top-right-radius: 15px;">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="conTitle">Modal title</h4>
</div>
<div class="modal-body" style="background-color:forestgreen;">
<p>One fine body…</p>
</div>
<div class="modal-footer" style="border-bottom-left-radius: 15px;border-bottom-right-radius: 15px;">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>

1、index.html引入jQuery文件,由于我有用到bootstrap,因此我引入了boostrap.css和bootstrap.js文件,要注意这些文件在文档中的位置和顺序;js文件一般放到最后在引入,由于bootstrap.js依赖jquery.文件,因此jquery.js要再比bootstrap.js先引入;

2、jq代码:

 $('#textDiv').load('modal.html',function(){
$('#modalBox').modal('show');
});

--1、 使用load的方法将modal.html加载到index.html中id为textDiv的div中;

--2、在使用函数对modal.html中的元素操作(弹幕);

最新文章

  1. Javascript中event.srcElement和event.target的区别
  2. Java常见面试题(含答案)
  3. 获取本机内存使用信息、DataTable占用内存空间
  4. 带选择的sql简单用法
  5. PHP 数组 foreach引用导致的bug
  6. css3 动画 执行一次
  7. 点亮led【转载】
  8. python 调试工具
  9. Hadoop2安装
  10. Nexus5如何手动OTA更新系统到4.4.3、4.4.4及常见问题回答
  11. [读书笔记]算法(Sedgewick著)&#183;第一章(1)
  12. 基于wax的lua IOS插件开发
  13. 介绍几个移动web app开发框架
  14. LinQ to SQL 增,删,改 代码演示
  15. asp.net mvc 接入美圣短信 验证码发送
  16. EPPlusHelper
  17. SQL优化总结之一
  18. getString与optString的区别
  19. java开发mis系统所需技术及其作用
  20. Python:笔记1_字符串处理【转载】

热门文章

  1. python 安装模块步骤
  2. linux下mysql函数的详细案列
  3. GetProcAddress 宏
  4. JVM实用参数——新生代垃圾回收
  5. css\html布局及部分知识小分享~~~
  6. 2个集合比较——最高效解法(Java实现)
  7. 配置Entity Framework连接Sql Server出现的一个异常
  8. 使用Spring整合javaMail发用邮件
  9. Different types of keystore in Java Overview
  10. 【Python】:简单爬虫作业