日期:2014-05-17 浏览次数:20704 次
<%@ page language="java" contentType="text/html; charset=Shift_JIS" pageEncoding="Shift_JIS"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> <title>Insert title here</title> <script type="text/javascript"> //shows(); shows();//这是下面一个子页面的js代码 </script> //如果上端js代码放在这。。会报错,提示找不到shows函数、、 </head> <body> <div class="page"> <ul class="tab"> <li id="tab_to_1" class="no"><a href="#" onclick="tab('tab',2,1)">CUSTOMIZE</a></li> <li id="tab_to_2"><a href="#" onclick="tab('tab',2,2)">SECURITY</a></li> </ul></div> <div><a href="#" onclick="shows()">CLICK</a></div> <div> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> <title>Insert title here</title> <script type="text/javascript"> function tab(a,b,c) { for(i=1;i<=b;i++){ if(c==i) { document.getElementById(a+"_mo_"+i).style.display = "block"; document.getElementById(a+"_show_"+i).style.display = "block"; document.getElementById(a+"_to_"+i).className = "no"; } else{ document.getElementById(a+"_mo_"+i).style.display = "none"; document.getElementById(a+"_show_"+i).style.display = "none"; document.getElementById(a+"_to_"+i).className = "q"; } } } function shows() { alert("1"); } </script> <style type="text/css"> *{ padding:0px; margin:0px;} body{ text-align:center;font-size:12px;} .page{ width:600px; margin:10px auto; text-align:left; } .tab_mo{ border:1px solid #ccc; border-top:none; padding:10px; background-color:#FFF; color:#fff; } .showDiv { background:#224499; padding:0px; color:#fff; margin:0px; } .tab{ border-bottom:1px solid #ccc; background-color:#fff; list-style:none; padding:4px 5px 3px 5px; } .tab li{ display:inline; font-size:12px; } .tab li a{ padding:3px 4px; border:1px solid #ccc; color:#888; border-bottom:none; text-decoration:none; background:#f7f7f7 } .tab li.no a{ background:#224499; border-bottom:none; position:relative; top:1px; color:#fff; font-weight:bold } </style> </head> <body> <div class="page"> <ul class="tab"> <li id="tab_to_1" class="no"><a href="#" onclick="tab('tab',2,1)">CUSTOMIZE</a></li> <li id="tab_to_2"><a href="#" onclick="tab('tab',2,2)">SECURITY</a></li> </ul> </body> </html> </div> <script type="text/javascript"> //shows(); shows(); </script>//如果放在这,所有js代码都加载完毕,就可以访问 </body> </html>