TEXTAREA ×Ö½ÚÏÞÖÆ(javascript£¬struts µÄÒ³Ãæ±êÇ©)
//Textarea maxlength
//flag:text¿òÃû×Ö£¬num:ÏÞÖƵÄ×Ö½ÚÊý
function maxLen(flag,num){
if(document.getElementById('lastMessage').value=="0" || document.getElementById('lastMessage').value==flag){
var i=document.getElementById(flag).value.replace(/[\u0800-\uffff]/g,"\u0061\u0061\u0061").length; //byte length
if(i>num){
switch(flag){
case ("textareaName"): document.getElementById('lastMessage').value="textareaName"; break;
default: break;
}
document.getElementById('message').value="³¬³ö·¶Î§("+ i+"/"+num+"λ)";
window.setTimeout( function(){ document.getElementById(flag).focus();document.getElementById(flag).select(); }, 0);
}else {
document.getElementById('message').value="";
document.getElementById('lastMessage').value="0";
&nbs
Ïà¹ØÎĵµ£º
Õⲿ·Ö˵һÏÂ×î½ü·Ç³£Á÷ÐеÄʼþ´úÀí¡£Ê¼þ´úÀíµÄʵÏÖ¼òµ¥À´Ëµ£¬ÊÇ°Ñʼþ°ó¶¨µ½Ä¿±êÔªËصÄ×æÏÈÔªËØÉÏ£¬È»ºóͨ¹ýðÅÝ»ò²¶»ñµÃµ½Ê¼þÔ´£¬È»ºóÔÙÅж¨Ê¼þÔ´ÊÇ·ñµÈÓÚÄ¿±êÔªËØÔÙÖ´Ðлص÷º¯Êý¡£ÓÉÓÚ¶ÔÄ¿±êÔªËصÄÅж¨ÓÐʱ·Ç³£Ä£ºý£¬Òò´Ëͨ¹ýÅж¨¼´¿Éµ÷Óûص÷º¯Êý£¬ÕâÑù£¬ÎÒÃǾʹﵽһ¸ö¼àÌýÆ÷ΪÐí¶àʼþÔ´·þÎñµÄÄ¿µÄ¡£¶ÔÓÚÐÔÄÜÒ»Ïò ......
http://blog.csdn.net/jiangfeng861016/archive/2009/12/18/5028620.aspx
º¯ÊýÊǽøÐÐÄ£¿é»¯³ÌÐòÉè¼ÆµÄ»ù´¡£¬±àд¸´ÔÓµÄAjaxÓ¦ÓóÌÐò£¬±ØÐë¶Ôº¯ÊýÓиüÉîÈëµÄÁ˽⡣JavaScriptÖеĺ¯Êý²»Í¬ÓÚÆäËûµÄÓïÑÔ£¬Ã¿¸öº¯Êý¶¼ÊÇ×÷Ϊһ¸ö¶ÔÏó±»Î¬»¤ºÍÔËÐеġ£Í¨¹ýº¯Êý¶ÔÏóµÄÐÔÖÊ£¬¿ÉÒԺܷ½±ãµÄ½«Ò»¸öº¯Êý¸³Öµ¸øÒ»¸ö±äÁ¿»òÕß½«º¯Êý×÷Ϊ²Î ......
Íê³ÉÒÔϲ¿·Ö£º
1. Ê÷¿ÉÒÔ½ÓÊÜsingleXml¸ñʽºÍjsonÒÔ¼°jsonarray¸ñʽµÄÊý¾Ý£»
2. ¸´Ñ¡¿ò¹´Ñ¡ºÍÕÛµþ×Ó½ÚµãµÄÂß¼ÓÃdivǶÌ×À´ÊµÏÖ,ЧÂʸü¸ß;²¢ÌṩÁË¿ìËÙ»Ê÷µÄ·½·¨;(´æÔÚbug:¿ìËÙ»Ê÷ЧÂʲ¢²»¸ß,divǶÌ×ÓÐÎÊÌâ);
3.Ôö¼ÓÊ÷µÄÉî¶È this.depth ......
<input type="text" onblur="if (value ==''){value='ÇëÊäÈë¹Ø¼ü×Ö'}" onfocus="if (value =='ÇëÊäÈë¹Ø¼ü×Ö'){value =''}" id="q" name="q" value="ÇëÊäÈë¹Ø¼ü×Ö" style="width: 100px; height: 14px;">
......
µÚÒ»ÖÖ:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ÎÞ±êÌâÎ ......