思路:点击父页面时写cookies--》刷新时从cookies中奖内容读取出来。
本文转自:http://blog.163.com/[email protected]/blog/static/114637885201282415580/
<body onbeforeunload="check()"> <iframe id=‘fjob‘ name=‘fjob‘ style=‘width:757px;margin-top:10px; height:960px;padding:0px 5px;border:0 solid #f00;‘ frameborder="0" scrolling="no" src={if $redirect_url} {$redirect_url} {else}"http://******.cn/jobs"{/if} > </iframe> </body> <script> $(document).ready(function() { var url = getCookie(‘pre_url‘); if (url) { $("#fjob").attr(‘src‘, ); } }); function check() { pre_url = window.frames[‘fjob‘].document.location; setCookie(‘pre_url‘, pre_url, 1); } function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "=") if (c_start!=-1) { c_start=c_start + c_name.length+1 c_end=document.cookie.indexOf(";",c_start) if (c_end==-1) c_end=document.cookie.length return unescape(document.cookie.substring(c_start,c_end)) } } return "" } function setCookie(c_name,value,expiredays) { var exdate=new Date() exdate.setDate(exdate.getDate()+expiredays) document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()) } </script>
时间: 2024-10-12 21:27:16