繁体   English   中英

功能尚未声明

[英]Function has not been declared

我正在尝试从按钮调用函数,但是当我按下按钮时,这是说尚未声明该名称的函数。

这是我的按钮代码:

<asp:TextBox ID="DateOutTxt" runat="server" Width="80px"></asp:TextBox><asp:ImageButton
                    ID="ImageButton5" runat="server" BorderStyle="None" ImageUrl="~/icons/vwicn063.gif"
                    OnClientClick="PopupPicker(DateOutTxt, 250, 250);" Width="21px" /></td>

这是我要调用的函数:

<script language ="javascript" type ="text/javascript">
    function PopupPicker(ctl, w, h) {
        var PopupWindow = null;
        settings = 'width=' + w + ',height=' + h + ',location=no,directories=no, menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
        PopupWindow = window.open(<%= getServerName.getserverName("/Quoteman/DatePicker.aspx?Ctl=") %>);
    PopupWindow.focus();
}
</script>

我目前在标签的底部有脚本标签,但是我尝试将其放在标签中和标签下方。 我似乎找不到问题。

语言是ASP.Net和Javascript。 这里也有对VB.Net函数的调用。

确保脚本的可用性,将脚本放在head标记中,或在呈现前的html元素中使用。 您以错误的方式传递了当前对象,请使用它代替DateOutTxt

更改

OnClientClick="PopupPicker(DateOutTxt, 250, 250);"

OnClientClick="PopupPicker(this, 250, 250);"

将scriptlet放在window.open中用引号引起来。

function PopupPicker(ctl, w, h) {
    var PopupWindow = null;
    settings = 'width=' + w + ',height=' + h + ',location=no,directories=no, menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
    PopupWindow = window.open('<%= getServerName.getserverName("/Quoteman/DatePicker.aspx?Ctl=") %>');
    PopupWindow.focus();
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM