javascript - Executing a function attached to a button -
i trying execute function has been pre-declared. function attached button when click button error message 'popuppicker has not been declared'.
below copy of function , buttons trying execute function.
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=") %> + ctl,'datepicker',settings); popupwindow.focus(); }
this buttons.
<td style="width: 120px"> <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> <td colspan="2" style="width: 100%"> <asp:textbox id="dateintxt" runat="server" width="80px"></asp:textbox> <asp:imagebutton id="imagebutton1" runat="server" borderstyle="none" imageurl="~/icons/vwicn063.gif" onclientclick="popuppicker('dateintxt', 250, 250);" width="21px" /> </td> <td colspan="1" style="width: 100px"> </td>
the languages javascript , html vb.net in there.
make sure declare function either inside <head></head>
or inside <body></body>
. this:
<html> <head> ... </head> <body> ... <script> function popuppicker(ctl,w,h) { ... } </script> </body> </html>
you should not put except comments or </html>
below </body>
tag. not valid.
if using jquery, make sure function not declared inside jquery's $(document).ready() outside of it. this:
<script> function popuppicker(ctl,w,h) { ... } $(document).ready(function(){..}) </script>
Comments
Post a Comment