2012-06-16 44 views
0

this question包括使用HTML网页页面时jQuery的不工作包括:

参考我们有一个日期头拾取组件(jQuery和CSS)。当单独存在标题时,日期选择器可以正常工作。当我尝试使用此标题将另一个页面包含为主体时,日期选择器不起作用。

我们使用this link

提到当我们有另一个页面上面提到的代码的日期选择器,日期挑不工作。

包括我使用的命令。 <%@ include file="enterClarity.jsp" %> 有一些表单验证Java脚本,这是目前在enterCalrity.jsp页

编辑:

单独

<!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=UTF-8"> 
<link rel="stylesheet" href="../css/calendar.css" type="text/css" /> 
<link rel="stylesheet" href="../css/datepicker_comp_1.css" type="text/css"/> 
<link rel="stylesheet" href="../css/datepicker_comp_2.css" type="text/css"/> 
<script type="text/javascript" src="../js/datepickr.js"></script> 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> 
<script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script> 
<script type="text/javascript" charset="utf-8"> 
jQuery(function(){ 
    jQuery("#datepicker").datepicker(); 
}); 
</script> 
<title>Clarity</title> 
</head> 

<body> 

<form id="clarityaction" name="tstest" onsubmit="return true;" action="/metrix/clarityaction.action" method="post"><table class="wwFormTable"> 
     <table width="100%" border="0" style="height: 616px; width: 1260px;" 
      cellpadding="0" cellspacing="0"> 
      <tr class="header"> 
       <td align="right" valign="bottom"> 
       <B>Welcome Karthik Prabhu D </B> 
       </td> 
      </tr> 
      <tr class="header"> 
       <td align="right" valign="top">your last login was : 2012-06-16 15:33:51.0 
       </td> 
      </tr> 
      <tr align="left" valign="bottom"><td> 
      <input type="text" id="datepicker" class="haspicker" /></td></tr> 



      <tr> 
       <td bgcolor="#FFFFFF" height="70%" width="100%"> 
        <table width="60%" border="0" style="height: 430px; width: 1206px;" 
         cellpadding="0" cellspacing="0"> 
         <tr> 
          <td> 
           <table border="0" cellpadding="0" cellspacing="0"> 
            <tr> 
             <td> 
              <table border="0"style="vertical-align: top" cellpadding="0" cellspacing="0"> 

               <tr> 
                <td> 

                </td> 
               </tr> 
              </table></td> 
             <td></td> 
             <td></td> 
            </tr> 
           </table> 
          </td> 

         </tr> 
        </table></td> 
      </tr> 

      <tr> 

       <td class="footer"></td> 
      </tr> 

     </table> 


    </table></form> 





</body> 

</html> 

头包含页面后:

<!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=UTF-8"> 
<link rel="stylesheet" href="../css/calendar.css" type="text/css" /> 
<link rel="stylesheet" href="../css/datepicker_comp_1.css" type="text/css"/> 
<link rel="stylesheet" href="../css/datepicker_comp_2.css" type="text/css"/> 
<script type="text/javascript" src="../js/datepickr.js"></script> 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> 
<script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script> 
<script type="text/javascript" charset="utf-8"> 
jQuery(function(){ 
    jQuery("#datepicker").datepicker(); 
}); 
</script> 
<title>Clarity</title> 
</head> 

<body> 

<form id="clarityaction" name="tstest" onsubmit="return true;" action="/metrix/clarityaction.action" method="post"><table class="wwFormTable"> 
     <table width="100%" border="0" style="height: 616px; width: 1260px;" 
      cellpadding="0" cellspacing="0"> 
      <tr class="header"> 
       <td align="right" valign="bottom"> 
       <B>Welcome Karthik Prabhu D </B> 
       </td> 
      </tr> 
      <tr class="header"> 
       <td align="right" valign="top">your last login was : 2012-06-16 15:36:10.0 
       </td> 
      </tr> 
      <tr align="left" valign="bottom"><td> 
      <input type="text" id="datepicker" class="haspicker" /></td></tr> 



      <tr> 
       <td bgcolor="#FFFFFF" height="70%" width="100%"> 
        <table width="60%" border="0" style="height: 430px; width: 1206px;" 
         cellpadding="0" cellspacing="0"> 
         <tr> 
          <td> 
           <table border="0" cellpadding="0" cellspacing="0"> 
            <tr> 
             <td> 
              <table border="0"style="vertical-align: top" cellpadding="0" cellspacing="0"> 

               <tr> 
                <td> 

<!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=UTF-8"> 
<script type="text/javascript" src="../js/tabing.js"></script> 
<script type="text/javascript" src="../js/tabjs.js"></script> 
<script type="text/javascript" src="../js/validaionjs.js"></script> 
<link rel="stylesheet" href="../css/tabStyle.css" type="text/css" /> 
</head> 
<body> 

<-- Other page contents -->   

</body> 

</html> 
+1

你可以给最终的HTML出现?也许jsp文件中的某些js会导致错误。 – avk

+0

_header与选取的日期_请解释? – Baz1nga

+0

也请出示你的代码,最好我已经编辑后生成的标记 – Baz1nga

回答

0

根据你发布的代码,第二个完整的html文件被注入到另一个。你有一个HTML页面在另一个...绝对不好;)

!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=UTF-8"> 
    <link rel="stylesheet" href="../css/calendar.css" type="text/css" /> 
    <link rel="stylesheet" href="../css/datepicker_comp_1.css" type="text/css"/> 
    <link rel="stylesheet" href="../css/datepicker_comp_2.css" type="text/css"/> 
    <script type="text/javascript" src="../js/datepickr.js"></script> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> 
    <script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script> 
    <script type="text/javascript" charset="utf-8"> 
    jQuery(function(){ 
     jQuery("#datepicker").datepicker(); 
    }); 
    </script> 
    <title>Clarity</title> 
    </head> 

    <body> 

    <form id="clarityaction" name="tstest" onsubmit="return true;" action="/metrix/clarityaction.action" method="post"><table class="wwFormTable"> 
      <table width="100%" border="0" style="height: 616px; width: 1260px;" 
       cellpadding="0" cellspacing="0"> 
[...]  
    <!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=UTF-8"> 
    <script type="text/javascript" src="../js/tabing.js"></script> 
    <script type="text/javascript" src="../js/tabjs.js"></script> 
    <script type="text/javascript" src="../js/validaionjs.js"></script> 
    <link rel="stylesheet" href="../css/tabStyle.css" type="text/css" /> 
    </head> 
    <body> 

    <-- Other page contents -->  
+0

我已经使用了一个页面包含。因此它是如此。我需要添加正文页面的页面页面。除了我所做的之外,还有其他的方式吗? – om39a

+1

您应该使用包含来包含通常在不同页面之间共享的标记的*部分*。您必须仅包含所需的标记,而不在您的容器页面中存在标记元素。 – mamoo

+2

问题是您的正文页面正在添加到标题HTML标记之后。您需要去除正文页面的重复标签并将其插入正文中。 – Jason