我正在尝试关注this。这在我的例子中产生了这个HTML:
<!DOCTYPE HTML>
<HTML xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:rdXslExtension="urn:rdXslExtension">
<HEAD>
<TITLE>LogiPoc</TITLE>
<LINK rel="stylesheet" type="text/css" href="rdTemplate/rdTheme/ProfessionalBlue/Theme.css" />
<LINK rel="stylesheet" type="text/css" href="rdTemplate/rdRoundCorners.css" />
<LINK rel="stylesheet" type="text/css" href="_SupportFiles/jqueryUI.css" />
<SCRIPT src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></SCRIPT><SCRIPT src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></SCRIPT><SCRIPT src="_SupportFiles/Test.js"></SCRIPT>
<META name="lgxver" content="11.4.46.313" />
<META http-equiv="X-UA-Compatible" content="IE=edge" />
<SCRIPT LANGUAGE="JavaScript" src="rdTemplate/rdYui/global.js"></SCRIPT><SCRIPT LANGUAGE="JAVASCRIPT" src="rdTemplate/rdYui/yui-preload-min.js"></SCRIPT><SCRIPT TYPE="text/javascript">function rdBodyLoad() {document.body.appendChild(YUI.Env.cssStampEl);
}
</SCRIPT><SCRIPT TYPE="text/javascript">function rdValidateForm() {}</SCRIPT>
</HEAD>
<BODY onload="rdBodyLoad()">
<FORM NAME="rdForm" method="POST">
<SPAN id="rdReportHeader"></SPAN><SPAN id="rdReportHeader-end"></SPAN>
<div id="rdMainBodyStart"></div>
<div id="rdMainBody">
<BR />
<DIV id="divDatePicker"></DIV>
<SPAN id="div1"></SPAN>
</div>
<div id="rdMainBodyEnd"></div>
<SPAN id="rdReportFooter"></SPAN><SPAN id="rdReportFooter-end"></SPAN>
<rdHidden></rdHidden>
</FORM>
</BODY>
</HTML>
Test.js包含:
$(document).ready(function() {
$("#divDatePicker").datepicker();
});
不幸的是,这不起作用。我认为原因是id为divDatePicker的div是嵌套的。它是否正确?你能建议一个解决方案吗?
答案 0 :(得分:1)
您需要在jquery.js
之前的页面中加入jqueryui.js
:
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<script src="_SupportFiles/Test.js"></script>
<!-- other scripts... -->
</head>