ʹÓÃjavascript»ñÈ¡Îı¾¿ò,ÏÂÀ¿ò,µ¥Ñ¡¿òµÄÖµ²¢ÇÒ¸³Öµ
1.Îı¾¿ò
1.1 <input type="text" name="test" id="test">
ͨ¹ývar t=document.getElementById("test").value°ÑÖµ¸³¸ø±äÁ¿t,
1.2 µ±È»Ò²¿ÉÒÔ·´¹ýÀ´°ÑÒÑÖªµÄ±äÁ¿Öµ¸³¸øÎı¾¿ò£¬ÀýÈ磺
var m = "5";
document.getElementById("test").value= m;
2.ÏÂÀÁбí¿ò
2.1 <select name="sel" id="sel" onchange="look();">
<option value="1" >11</option>
<option value="2" selected>22</option>
<option value="3">33</option>
</select>
ͨ¹ývar s=document.getElementById("sel").value»ñÈ¡<select>¿òÖÐÑ¡ÖеÄÖµ£¬´Ë´¦Ä¬ÈÏÑ¡ÖÐvalue="2"µÄÑ¡ÏËùÒÔ¸³¸ø±äÁ¿s µÄÖµÊÇ"2",¶ø²»ÊÇ"22",
¼ÙÈçÒª°Ñ<select>ÖÐÑ¡ÔñµÄ"Öµ"Èç"3"¶ÔÓ¦µÄ"Îı¾Öµ"("33")¸³¸øtestÎı¾¿ò£¬¿ÉÒÔͨ¹ýÈçÏ·½·¨£¬
<script language="javascript">
function look(){
var se =document.getElementById("sel");
var option=se.getElementsByTagName("option");
var str = "" ;
for(var i=0;i<option.length;++i)
{
if(option[i].selected)
{
document.getElementById("test").value = option[i].text;
}
&nb
Ïà¹ØÎĵµ£º
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)> <td>no </table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡Ïûѡȡ¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false&quo ......
/*
ÓÃ;£º¼ì²éÊäÈë×Ö·û´®ÊÇ·ñÖ»ÓÉÓ¢ÎÄ×ÖĸºÍÊý×ÖºÍÏ»®Ïß×é³É
ÊäÈ룺
s£º×Ö·û´®
·µ»Ø£º
Èç¹ûͨ¹ýÑéÖ¤·µ»Øtrue,·ñÔò·µ»Øfalse
*/
function isNumberOr_Letter( s ){//ÅжÏÊÇ·ñÊÇÊý×Ö»ò×Öĸ
var regu = "^[0-9a-zA-Z\_]+$";
var re = new RegExp(regu);
if (re.test(s)) {
return true;
}else{
return false;
} ......
JavaScript ʹÓü¼ÇÉ
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)> <td>no </table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡Ïûѡȡ¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncop ......
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)> <td>no </table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡Ïûѡȡ¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncopy="return false;" oncut="re ......
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)> <td>no </table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡Ïûѡȡ¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ ......