Javascript ASP.NET母版页<;脚本>;不跑步

Javascript ASP.NET母版页<;脚本>;不跑步,javascript,c#,jquery,html,asp.net,Javascript,C#,Jquery,Html,Asp.net,我有一个包含多个UpdatePanel的页面,这些页面都是可见的false,当您单击按钮时,我会一个接一个地显示它们。 我想使用bootstrap日期时间选择器,但我的问题是,该脚本不是由浏览器运行的 <script type="text/javascript"> $(function () { $('#datetimepicker1').datetimepicker(); }); </script> $(函数(){ $('#date

我有一个包含多个UpdatePanel的页面,这些页面都是可见的false,当您单击按钮时,我会一个接一个地显示它们。 我想使用bootstrap日期时间选择器,但我的问题是,该脚本不是由浏览器运行的

<script type="text/javascript">
    $(function () {
        $('#datetimepicker1').datetimepicker();
    });
 </script>

$(函数(){
$('#datetimepicker1')。datetimepicker();
});
如果我在控制台中运行此命令,所有操作都正常。 有没有关于如何强制运行脚本的想法

应要求:

$(function () {
    $('#datetimepicker1').datetimepicker();
});
init[1]0: documentcontext: documentURL: "http://localhost:52261/Dashboard.aspx"activeElement: bodyalinkColor: ""all: HTMLAllCollection[520]anchors: HTMLCollection[0]applets: HTMLCollection[0]baseURI: "http://localhost:52261/Dashboard.aspx"bgColor: ""body: bodycharacterSet: "UTF-8"charset: "UTF-8"childElementCount: 1childNodes: NodeList[2]children: HTMLCollection[1]compatMode: "CSS1Compat"contentType: "text/html"cookie: ""cphNavigation_imgProfile: undefinedcurrentScript: nulldefaultView: WindowdesignMode: "off"dir: ""doctype: <!DOCTYPE html>documentElement: htmldocumentURI: "http://localhost:52261/Dashboard.aspx"domain: "localhost"embeds: HTMLCollection[0]fgColor: ""firstChild: <!DOCTYPE html>firstElementChild: htmlfonts: FontFaceSetforms: HTMLCollection[1]head: headhidden: falseimages: HTMLCollection[1]implementation: DOMImplementationinputEncoding: "UTF-8"isConnected: truejQuery19107336506808681962: 1lastChild: htmllastElementChild: htmllastModified: "02/17/2017 11:51:13"linkColor: ""links: HTMLCollection[68]location: LocationnextSibling: nullnodeName: "#document"nodeType: 9nodeValue: nullonabort: nullonauxclick: nullonbeforecopy: nullonbeforecut: nullonbeforepaste: nullonblur: nulloncancel: nulloncanplay: nulloncanplaythrough: nullonchange: nullonclick: nullonclose: nulloncontextmenu: nulloncopy: nulloncuechange: nulloncut: nullondblclick: nullondrag: nullondragend: nullondragenter: nullondragleave: nullondragover: nullondragstart: nullondrop: nullondurationchange: nullonemptied: nullonended: nullonerror: nullonfocus: nulloninput: nulloninvalid: nullonkeydown: nullonkeypress: nullonkeyup: nullonload: nullonloadeddata: nullonloadedmetadata: nullonloadstart: nullonmousedown: nullonmouseenter: nullonmouseleave: nullonmousemove: nullonmouseout: nullonmouseover: nullonmouseup: nullonmousewheel: nullonpaste: nullonpause: nullonplay: nullonplaying: nullonpointercancel: nullonpointerdown: nullonpointerenter: nullonpointerleave: nullonpointerlockchange: nullonpointerlockerror: nullonpointermove: nullonpointerout: nullonpointerover: nullonpointerup: nullonprogress: nullonratechange: nullonreadystatechange: nullonreset: nullonresize: nullonscroll: nullonsearch: nullonseeked: nullonseeking: nullonselect: nullonselectionchange: nullonselectstart: nullonshow: nullonstalled: nullonsubmit: nullonsuspend: nullontimeupdate: nullontoggle: nullonvolumechange: nullonwaiting: nullonwebkitfullscreenchange: nullonwebkitfullscreenerror: nullonwheel: nullorigin: "http://localhost:52261"ownerDocument: nullparentElement: nullparentNode: nullplugins: HTMLCollection[0]pointerLockElement: nullpreferredStylesheetSet: nullpreviousSibling: nullreadyState: "complete"referrer: "http://localhost:52261/Default.aspx"rootElement: nullscripts: HTMLCollection[18]scrollingElement: bodyselectedStylesheetSet: nullstyleSheets: StyleSheetListtextContent: nulltitle: "Credit Hire Portal"visibilityState: "visible"vlinkColor: ""webkitCurrentFullScreenElement: nullwebkitFullscreenElement: nullwebkitFullscreenEnabled: truewebkitHidden: falsewebkitIsFullScreen: falsewebkitVisibilityState: "visible"xmlEncoding: nullxmlStandalone: falsexmlVersion: null__proto__: HTMLDocumentlength: 1__proto__: Object[0]
$(函数(){
$('#datetimepicker1')。datetimepicker();
});
初始化[1]0:documentcontext:documentURL:“http://localhost:52261/Dashboard.aspxactiveElement:bodyalinkColor:“所有:HTMLAllCollection[520]锚定:HTMLCollection[0]小程序:HTMLCollection[0]baseURI:”http://localhost:52261/Dashboard.aspx“bgColor:”正文:正文字符集:“UTF-8”字符集:“UTF-8”子元素计数:1子节点:节点列表[2]子项:HTMLCollection[1]compatMode:“CSS1Compat”内容类型:“text/html”cookie:“cphNavigation\u imgProfile:UnfinedCurrentScript:nulldefaultView:WindowdesignMode:“off”目录:“doctype:documentElement:htmldocumentURI:”http://localhost:52261/Dashboard.aspx域:“localhost”嵌入:HTMLCollection[0]fgColor:“firstChild:firstElementChild:htmlfonts:FontFaceSetforms:HTMLCollection[1]head:headhidden:FalsImages:HTMLCollection[1]实现:domImplementionInputCodeding:“UTF-8”已连接:TrueJQuery1910733365068681962:1lastChild:HTMLAssetChild:HTMLAssetModified:“02/17/2017 11:51:13”链接颜色:“链接:HTMLCollection[68]位置:LocationnextSibling:nullnodeName:“文档”nodeType:9nodeValue:nullonabort:nullonauxclick:nullonbeforecopy:nullonBeforeChange:nulloncut:nullonbeforepaste:nullonblur:nulloncanplay:nulloncanplaythrough:nullonchange:nullonclick:nullonclose:nullonContext菜单:nulloncopy复制:nulloncuechange:nulloncut:nullondblclick:nullondBrag:nullondragendnullondragover:nullondragstart:nullondrop:nullondurationchange:nullonEmpties:nullonended:nullonerror:nullonfocus:nulloninput:nulloninvalid:nullonkeydown:nullonkeypress:nullonkeyup:nullonLoaded:nullonloadedmetadata:nullonloadstart:nullonMousedDown:nullonMouseCenter:nullonmouseleave:nullonMouseMouseOut:nullonmouseover:nullonmouseup:nullonmousewheel:nullonpaste:nullonpause:nullonplay:nullonplay:nullonpointercancel:nullonpointerdown:nullonpointerleave:nullonpointerlockchange:nullonpointerlockerror:nullonpointermove:nullonpointerout:nullonpointerover:nullonpointerup:nullonprogress:nullonratechange:nullonreadystatechange:nullonreset:nullonresize:nullonscroll:nullonsearch:NullOnSeek:NullOnSelected:nullonselectionchange:nullonselectstart:nullonshow:NullOnInstalled:nullonsubmit:nullonsuspend:nullontimeupdate:nullontoggle:nullonvolumechange:nullonwaiting:nullonwebkitfullscreenchange:nullonwebkitfullscreenerror:nullonwheel:nullorigin:“http://localhost:52261ownerDocument:nullparentElement:nullparentNode:nullplugins:HTMLCollection[0]pointerLockElement:nullpreferredStylesheetSet:nullpreviousSibling:nullreadyState:“完成”引用者:http://localhost:52261/Default.aspx“rootElement:nullscripts:HTMLCollection[18]scrollingElement:bodyselectedStylesheetSet:nullstyleSheets:StyleSheetListtextContent:nulltitle:“信用租赁门户”可见性状态:“可见”vlinkColor:“webkitCurrentFullScreenElement:nullwebkitFullscreenElement:nullwebkitFullscreenEnabled:truewebkitHidden:falsewebkitIsFullScreen:falsewebkitVisibilityState:“可见”xmlEncoding:nullxmlStandalone:falsexmlVersion:null\uuuuuuuuuuuuuuuuuuuuuu:HTMLDocumentlength:1\uuuuuuuuuuuuuuuuuuuuuuuuuuuuu:Object[0]
更新1 在母版页中,我有两个ContentPlaceholder,一个用于导航栏,另一个用于多步骤表单(在这里我有datetimepicker)。
如果我将datetimepicker放在导航内容上,则所有内容都在工作…:(

您需要确保您的脚本在所有的.js(库文件)的声明下


$(函数(){
$('#datetimepicker1')。datetimepicker();
});
您还可以在浏览器的控制台窗口中看到脚本错误。
例如,在chrome浏览器中,按F12键,然后单击console。它将显示脚本的错误。

脚本在js库的声明下?datetimepicker的声明在头部,脚本在底部您是否确实获得了id为“datetimepicker1”的元素在页面中?加载页面时浏览器控制台中是否绝对没有错误?是否“document.ready”部分正在运行?即,您能否在调用datetimepicker的上方放置一个console.log,以证明整个函数正在运行?我所有的脚本都在标题中,而这一个在底部。控制台中没有错误我确信顺序正确。如果脚本中出现错误,您需要尝试检查控制台窗口以帮助您。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.45/js/bootstrap-datetimepicker.min.js"></script>
<script src="Link of other.js"></script>

<script type="text/javascript">
 $(function () {
        $('#datetimepicker1').datetimepicker();
    });
</script>