javasript:首碼 與 事件處理常式的邦定
來源:互聯網
上載者:User
在IE中預設的都是vbsricpt的,所有javascript的都要加javasript:首碼,要不就報錯<td style="text-align:right;height:27px" valign="top"
colspan="6">
<input class="short_button_style"
onClick="
javaScript:
if ( document.getElementById('confirmFlg').value == '1' ) {
var n = showSaveConfirmMessage();
if (n == 1) {
document.applicationListForm.insertAction.value = '1';
document.applicationListForm.menuId.value = '222';
document.applicationListForm.submit();
return false;
}
if (n == 2) {
showDialog();
}
if (n == 3) {
return false;
}
}
showDialog();
"
type="button" value="印刷" tabindex="6">
</td> 《征服 Ajax ---Web 2.0 開發技術詳解》 P/107 說,通常情況下,在JavaScript中可以使用兩種形式將事件處理常式邦定到特定的事件中,分別是嵌入HTML標記以及使用對象的事件屬性和attachEvent()方法。通常事件處理常式並不會這麼簡單,而會包括多行JavaScript代碼,但如果把所有的處理常式都放在onclick屬性中(語句間只能用分號隔開,不能換行)。< 但如上之例,可以換行啊> <td colspan="2"
style="text-align:left;vertical-align:bottom;font-weight:bold;">
<a tabindex="8"
style="color: blue;"
href="
javaScript:
document.applicationListForm.searchAction.value = 'theDayAfterTomorrow';
addOpePlanDay('2');
document.applicationListForm.submit();
">
翌々日未準備件數
<c:out value="${applicationList.afterTomorrowNoreadyCount}" />
件
</a>
</td>