HTML5页面调用jsp页面中的参数
html页面:
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="format-detection" content="telephone=no" /> <meta http-equiv="Access-Control-Allow-Origin" content="*"> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width" /> <link rel="stylesheet" href="../css/base.css"> <script src="../js/jquery-2.1.1.min.js"></script> <title>调用jsp中的参数</title> </head> <body> <a href="javascript:;" id="shengji" class="shengji">点击获取参数</a> <iframe id="myf" src="newestapp.jsp" frameborder="0" scrolling="no" width="0" height="0"></iframe> <script type="text/javascript"> function callIframeField() { return $("#myf")[0].contentWindow.URL_con; } $(‘.shengji‘).click(function(){ var url = callIframeField(); alert(url) }) </script> </body> </html>
jsp页面:
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Cache-Control" content="no-cache"/> <meta name="viewport" content="width=device-width; initial-scale=1.0; minimum-scale=1.0; maximum-scale=1.0"/> <meta name="MobileOptimized" content="320"/> </head> <body> <script> var URL_con = "http://www.baidu.com";//传html的参数也可,为何用jsp,因为此处的url获取需要后台java支持,jsp代码省略。参数传成功即可。 </script> </body> </html>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。