Javascript技巧
報警信息顯示在頁面上的處理:在需要報警的文本處:<SPAN id="message" STYLE="color:red"></SPAN>
給報警信息賦值: window.parent.record_handler.message.innerText = "警告信息";
按鈕啟用/禁用的處理
<input type = "button" name="selebatch" class = "myBtn" onClick="select_on()" value = "批次選擇" disabled>
啟用按鈕:
window.parent.parent.record_handler.myform.selebatch.disabled=false;
禁用按鈕:
window.parent.parent.record_handler.myform.selebatch.disabled=true;
每隔二十秒自動刷新頁面:
<meta http-equiv="refresh" content="20">
javascript 字符串截取功能比較
String.substr(N1,N2) 這個就是我們常用的從指定的位置(N1)截取指定長度(N2)的字符串;
String.substring(N1,N2) 這個就有點特別了,它是先從N1,N2里找出一個較小的值,然后從字符串的開始位置算起,截取較小值位置和較大值位置之間的字符串,截取出來的字符串的長度為較大值與較小值之間的差。
下拉框位置判斷。
<select name="month_share" style="width:140" onchange="ChangePlanType();" >
<%=DropdownList.getDropList("yymm","months","months","","","","ELOGISDBCON")%></select>
下拉框位置判斷語句:myform.month_share.selectedIndex 從0開始。
當頁面不能刷新時,
在
window.parent.parent.record_list_d.location.reload();前增加
window.document.location.replace("about:blank");
如:
<script language="javascript">
window.document.location.replace("about:blank");
alert("數據刪除成功!");
window.parent.parent.record_list_d.location.reload();
</script>
HTML取值:
<td width="33%" id="strength_L">弱</td>
取值:document.getElementById("strength_L").innerHTML 結果:弱
CSS背景色更改:document.getElementById("strength_L").style.background="#FF0000";
posted on 2006-11-16 10:02 半導體 閱讀(244) 評論(0) 編輯 收藏 所屬分類: javascript