display不能解决<jsp:include />的问题,jsp异步加载另外一个jsp页面
2014-12-14 16:59
936 查看
前几天,自己在用echart力度导向图做一个关系图的时候遇到了这个问题。我需要一个按钮加载另外那个动态生成力度导向图。
问题:解决a.html中包含<jsp:include page="b.jsp"/> 一开始display=“none”,点击链接或按钮加载b.html,b.html中css样式不能使用的问题。
优点:动态加载,html和html中都可以使用。
废话不多说,看代码,我提供了两种方法
方法一:<a>标签
a.html
里面是我自己做的一个图片,可以改。
b.html
方法二:按钮
a.html写在一起了
问题:解决a.html中包含<jsp:include page="b.jsp"/> 一开始display=“none”,点击链接或按钮加载b.html,b.html中css样式不能使用的问题。
优点:动态加载,html和html中都可以使用。
废话不多说,看代码,我提供了两种方法
方法一:<a>标签
a.html
<html> <head> <title>异步加载</title> <meta charset=UTF-8> </head> <script type="text/javascript" src="../js/jquery-1.7.2.js"></script> <body> <a onclick=" $(document).ready(function(){ alert('A页面'); $('#conf').load('b.html'); }); "><img src ="forward.jpg"/></a> <div id="conf"></div> </body> </html>
里面是我自己做的一个图片,可以改。
b.html
<html> <head> <title>bhtml</title> </head> <body> <span style="white-space:pre"> </span>这是bhtml <span style="white-space:pre"> </span></body> </html>点击页面图片,即可加载另外一个页面。
方法二:按钮
a.html写在一起了
<html> <head> <title>异步加载</title> <meta charset=UTF-8> </head> <script type="text/javascript" src="../js/jquery-1.7.2.js"></script> <script type="text/javascript"> function forword(){ $(document).ready(function(){ alert('A页面'); $('#conf').load('b.html'); }); } </script> <body> <a onclick=" $(document).ready(function(){ alert('A页面'); $('#conf').load('b.html'); }); "><img src ="forward.jpg"/></a> <input type="button" value="跳转到B" onclick="forword();"/> <div id="conf"></div> </body> </html>
相关文章推荐
- <s:property>标签从后台读取Date类型年份为两位在jsp页面显示的解决方法
- JSP 中使用<%@include%> 报 Duplicate local variable path 错误的解决方法
- 解决properties-maven-plugin不能读取<configuration>的问题
- js给<object>视频赋值 延迟加载,解决不能修改的html对象的问题 .
- Jsp页面关于BootStrap模态框和<a href onclick>事件不能同时使用,以及传参的问题
- <jsp:include page=""/>和<%@include file=""%>-----JSP中两种页面引入方式的区别
- 使用<jsp:include>,不想写死URL,动态生成URL的解决的方法
- JSP 使用<%@include%>报Duplicate local variable path 错误 解决方法
- struts2 jsp页面访问List, set 和<s:iterator>的使用
- Ajax的异步通信引发的一个随机性问题<2> 异步请求的问题来了
- ₪<jsp:include>与include指令的比较
- <jsp:include>
- <jsp:include page=""> 与<%@ include file=""%>理解
- <jsp:include>与include指令的比较
- <%@ include file=”relativeURI”%>与<jsp:include page=””>的区别
- <jsp:include> 嵌套Servlet请求,导致Stream closed异常
- js正则:匹配一个html的tagname的开始标签,主要是解决包含&lt;&gt;(正则的效率问题建议不使用)
- &lt;jsp:include page=&quot;&quot;&gt; 与&lt;%@ include file=&quot;&quot;%&gt;
- JSP中使用哪个标签允许向<include/>标签传递参数
- <jsp:include>与include指令的区别