我有一个放在 document.ready 中的函数,该函数是从特定按钮的 onclick 调用的。单击按钮时没有任何反应。
$(document).ready(function()
{
function myFunctionDelete()
{
alert("Delete Clicked.");
}
}
这是链接到该按钮的相应 HTML。
<form action="edit.php" method="POST">
<table>
<tr id="formTitle" name="formTitle"><strong>Edit Event Now</strong></tr>
<input type="hidden" id="deletedHidden" name="deletedHidden" value="" />
<input type="hidden" id="dateForm2" name="dateForm2" value="" />
<input type="hidden" id="titleEditOld" name="titleEditOld" value="" />
<tr id="formTitle"><td><label id="titleLabel" for="Title"><strong>Title:</strong></label><input id="titleEdit" name="titleEdit" type="text" value="Event Title">
<tr id="formTitle"><td><label for="startTimeHours"><strong>Time:</strong></label><select id="startHours" name="startHours"><option>--</option> <option>12</option> <option>1</option><option>2</option> <option>3</option><option>4</option>
<option>5</option><option>6</option>
<option>7</option><option>8</option>
<option>9</option><option>10</option>
<option>11</option></select>
<select id="startMinutes" name="startMinutes"><option>--</option> <option>00</option>
<option>05</option><option>10</option>
<option>15</option><option>20</option>
<option>25</option><option>30</option>
<option>35</option><option>40</option>
<option>45</option><option>50</option>
<option>55</option></select>
<input type="radio" name="AMPM" value="am">am
<input type="radio" name="AMPM" value="pm">pm<br>
<p><strong>All Day Event?</strong>
<input type="checkbox" name="AllDay" value="true"></p>
<tr id=formTitle"><td><input id="submit" type="submit" value="Submit">
<button type="button" onclick="myFunctionDelete()">Delete Event</button>
</table>