Jquery asp.net-按钮赢得';t在单击时执行功能
我通过某人的帮助获取了这段代码,并希望在单击Jquery asp.net-按钮赢得';t在单击时执行功能,jquery,html,button,html2canvas,Jquery,Html,Button,Html2canvas,我通过某人的帮助获取了这段代码,并希望在单击#print_按钮后执行它。由于某种原因,我不能让它工作,我不知道我哪里出了问题 这是jquery: $(document).ready(function () { $('#Print_Button').click(function () { var html2obj = html2canvas($('#form1')); var queue = html2obj.p
#print_按钮
后执行它。由于某种原因,我不能让它工作,我不知道我哪里出了问题
这是jquery:
$(document).ready(function () {
$('#Print_Button').click(function () {
var html2obj = html2canvas($('#form1'));
var queue = html2obj.parse();
var canvas = html2obj.render(queue);
var img = canvas.toDataURL();
window.open(img);
});
});
以及“我的按钮”的HTML属性:
id="Print_Button" runat="server" value="Print"
谁能告诉我哪里出了问题
这是正文的完整html:
<form id="form1" runat="server">
<div class="header">
<strong class="auto-style11">
MCN PRINTOUT
</strong>
<img alt="Veolia Logo" class="logo" src="logo.png" />
<input type="button" id="Print_Button" value="click me"/>
</div>
<div id="nav">
<ul>
<li><a href="login.aspx">Home</a></li>
<li><a href="MCNForm.aspx">MCN Entry</a></li>
<li><a href="Search.aspx">MCN Search</a></li>
</ul>
</div>
<div id ="main">
<p id ="main_header"></p>
<p id ="mcn">DISPOSAL ADVICE/TRANSFER NOTE</p>
<p id="address">
</p>
<table id="table_1"">
<tr>
<td class="auto-style12">MCN Ref No.</td>
<td>
<asp:TextBox ID="TextBox1" ReadOnly="True" runat="server" Width="116px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style12">Date:</td>
<td>
<asp:TextBox ID="TextBox4" ReadOnly="True" runat="server" Width="116px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style12">Time:</td>
<td>
<asp:TextBox ID="TextBox5" runat="server" ReadOnly="True" Width="116px"></asp:TextBox>
</td>
</tr>
</table>
<img alt="Logo" class="auto-style10" src="logo.png" /><div id ="form">
<table id="main_table" class = "table table-bordered">
<tr>
<td class="auto-style8">SITE:</td>
<td class="auto-style9">
<asp:TextBox ID="TextBox6" runat="server" OnTextChanged="TextBox6_TextChanged" ReadOnly="True"></asp:TextBox>
</td>
<td class="auto-style4">HAULIER(CARRIER):</td>
<td>
<asp:TextBox ID="TextBox10" runat="server" ReadOnly="True"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style8">DESCRIPTION OF WASTE:</td>
<td class="auto-style9">
<asp:TextBox ID="TextBox7" runat="server" ReadOnly="True"></asp:TextBox>
</td>
<td class="auto-style4">DESTINATION:</td>
<td>
<asp:TextBox ID="TextBox9" runat="server" ReadOnly="True"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style8">EWC CODE:</td>
<td class="auto-style9">
<asp:TextBox ID="TextBox8" runat="server" ReadOnly="True"></asp:TextBox>
</td>
<td class="auto-style4">VEHICLE REGISTRATION:</td>
<td>
<asp:TextBox ID="TextBox11" runat="server" ReadOnly="True"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style8">QUANTITY:</td>
<td class="auto-style9">
<asp:TextBox ID="TextBox13" runat="server" ReadOnly="True"></asp:TextBox>
</td>
<td class="auto-style4">DRIVER NAME:</td>
<td>
<asp:TextBox ID="TextBox12" runat="server" ReadOnly="True"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style8">NOMINAL WEIGHT:</td>
<td class="auto-style9">
<asp:TextBox ID="TextBox15" runat="server" ReadOnly="True"></asp:TextBox>
</td>
<td class="auto-style4">SKIP ID:</td>
<td>
<asp:TextBox ID="TextBox16" runat="server" ReadOnly="True"></asp:TextBox>
</td>
</tr>
</table>
<table id="table_2" style="width:30%;">
<tr>
<td>DUTY OF CARE:</td>
<td>
<asp:TextBox ID="TextBox14" runat="server" OnTextChanged="TextBox14_TextChanged"></asp:TextBox>
</td>
</tr>
</table>
</div>
<p id="tsandcs">
</p>
</div>
<div class="footer">
<p id ="footer_menu">Menu</p>
<p id="copyright">© 2017 ...</p>
</div>
</form>
MCN打印输出
处置通知/转移通知单
使用输入类型按钮
$(文档).ready(函数(){
$(“#打印按钮”)。单击(函数(){
警报(“点击”);
//你的代码在这里
});
});代码>
onclick事件没有问题。尝试发出警报,您将看到一个警报框。。我想还有别的地方不对劲。发布完整的htmlcode@neophyte,请查看上面添加的完整html,已经尝试了下面的建议,但仍然不起作用。该警报肯定按照@Sandeep Bhaskar的建议工作,因此之后一定是Jquery,但无法找出它在为其他人工作时出错的地方。嗨@Sandeep Bhaskar,您建议的警报将起作用,但它本身的功能不起作用,在这里的另一篇文章中,它对其他人起作用。我已经在原来的帖子中发布了完整的HTML。