function insertQuestion(form) {
var x = "<img src='Images/plussigndisabled.jpg' width='30' height='30' alt='Look Up Previous Question' class='plusimage' name='plusbuttonrow'/><span id='plussignmsg'>(Click Plus Sign to look <br/> up Previous Questions)</span>";
if (qnum == <? php echo(int) $_SESSION['textQuestion']; ?> ) {
$('#mainPlusbutton').replaceWith(x);
}
//append rows into a table code, not needed for this question
}....
$('.plusimage').live('click', function () {
plusbutton($(this));
});
function plusbutton(plus_id) {
// Set global info
plusbutton_clicked = plus_id;
// Display an external page using an iframe
var src = "previousquestions.php";
$.modal('<iframe src="' + src + '" style="border:0;width:100%;height:100%;">');
return false;
}
<form id="QandA" action="<?php echo htmlentities($action); ?>" method="post">
<table id="question">
<tr>
<td colspan="2">
<a onclick="return plusbutton();">
<img src="Images/plussign.jpg" width="30" height="30" alt="Look Up Previous Question" class="plusimage" id="mainPlusbutton" name="plusbuttonrow"/>
</a>
<span id="plussignmsg">
(Click Plus Sign to look up Previous Questions)
</span>
</td>
</tr>
</table>
<table id="questionBtn" align="center">
<tr>
<th>
<input id="addQuestionBtn" name="addQuestion" type="button" value="Add Question" onClick="insertQuestion(this.form)" />
</th>
</tr>
</table>
</form>
在上面的代码中,当满足 if 语句时,我可以用另一个图像替换一个图像。但我的问题是,当图像被替换时,它不会禁用点击事件。我的问题是,当图像被替换时,如何禁用 onclick 事件onclick="return plusbutton();
?
在这种情况下可以取消绑定点击工作。我不想使用href=#
,因为我不想在 url 末尾包含 #