Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javascriptдµÄ±í¸ñÅÅÐò

/**
* ±í¸ñÅÅÐò(µ¥¸ö±í¸ñ£¬½µÐò)
* @example
* <code>
* <table is_sort="1">
* <tr>
* <th><a href="javascript:void(0)" mce_href="javascript:void(0)" onclick="table_sort(0, 0)">field1</a></th>
* <th><a href="javascript:void(0)" mce_href="javascript:void(0)" onclick="table_sort(1, 1, 1)">field2</a></th>
* </tr>
*
* <!-- ´Ëtr²»»á²ÎÓëÅÅÐò -->
* <tr>
* <th>...</th>
* <td>...</td>
* </tr>
*
* <!-- ´Ëtr²ÎÓëÅÅÐò is_sortÊôÐÔ sort_valÊôÐÔ -->
* <tr is_sort="1">
* <th sort_val="val1">...</th>
* <th sort_val="val2">...</th>
* </tr>
* ...
* </table>
* </code>
* @param int index ÐèÒªÅÅÐòµÄÁУ¨´Ó0¿ªÊ¼£©
* @param int is_desc ÊÇ·ñ½µÐò
* @param int is_int ÊÇ·ñÐèÒª½«ÅÅÐòֵת»»³ÉintÀàÐÍ
* @return void
*/
function table_sort(index, is_desc, is_int)
{
$('table[is_sort=1]').each(function(){
var i=0, j=0, this_table = this, is_change=false, tr = null, tmp = null, sort_val1=0, sort_val2=0, pattern=/^0+/;
$('tr[is_sort=1]').each(function(){
j = 0;
tr = this;
$('tr[is_sort=1]', this_table).each(function(){
if (j>=i)
{
is_change = false;

//¸ñʽ»¯ÅÅÐòÖµ
sort_val1 = $($('th,td', tr).get(index)).attr('sort_val');
sort_val2 = $($('th,td', this).get(index)).attr('sort_val');

if (is_int)
{
if (sort_val1!='0')
{
sort_val1 = parseInt(sort_val1.replace(pattern, ''));
}
if (sort_val2!='0')
{
sort_val2 = parseInt(sort_val2.replac


Ïà¹ØÎĵµ£º

javascriptµ¯³ö´°¿Ú´úÂë

ÖÆ×÷Javascriptµ¯³ö´°¿Ú¼¼ÇɾÅÔò
1¡¢×î»ù±¾µÄµ¯³ö´°¿Ú´úÂë
¡¡¡¡Æäʵ´úÂë·Ç³£¼òµ¥£º
¡¡¡¡< SCRIPT LANGUAGE="javascript">
¡¡¡¡< !--
¡¡¡¡window.open ("page.html")
¡¡¡¡--
>
¡¡¡¡< /SCRIPT>
¡¡¡¡ÒòΪÕâÊÇÒ»¶ÎJavascript´úÂ룬ËùÒÔËüÃÇÓ¦¸Ã·ÅÔÚ< SCRIPT LANGUAGE="javascript">Ö®¼ä¡£ ......

JavaScriptÖÐsetAttributeÓ÷¨


ÎÒÃǾ­³£ÐèÒªÔÚJavaScriptÖиøElement¶¯Ì¬Ìí¼Ó¸÷ÖÖÊôÐÔ£¬Õâ¿ÉÒÔͨ¹ýʹÓÃsetAttribute()À´ÊµÏÖ£¬Õâ¾ÍÉæ¼°µ½ÁËä¯ÀÀÆ÷µÄ¼æÈÝÐÔÎÊÌâ¡£
setAttribute(string name, string value)£ºÔö¼ÓÒ»¸öÖ¸¶¨Ãû³ÆºÍÖµµÄÐÂÊôÐÔ£¬»òÕß°ÑÒ»¸öÏÖÓеÄÊôÐÔÉ趨Ϊָ¶¨µÄÖµ¡£
1¡¢ÑùʽÎÊÌâ
setAttribute(class, value)ÖÐclassÊÇÖ¸¸Ä±äclassÕâ¸öÊôÐ ......

javascript¼¼ÇÉ

1¡¢×Ö·û´®×ª»»ÎªÊýÖµ
³£¹æ·½·¨£º
JScript code
var a = parseFloat("12");
var b = parseInt("34");
¿ÉÒÔÓÃ
JScript code
var a = +("12");
var b = +("34");
2¡¢¶àάÊý×é
³£¹æ·½·¨£º
JScript code
var A = new Array(2);
A[0] = new Array(2);
A[1] = new Array(2);
A[0][0] = 1;
A[0][1] = 2;
A[1][0] = ......

javascript ÖÐcallÓëapplyÇø±ð

1.call·½·¨
¹Ù·½£¨JavaScriptÊֲᣩ£º
µ÷ÓÃÒ»¸ö¶ÔÏóµÄÒ»¸ö·½·¨£¬ÒÔÁíÒ»¸ö¶ÔÏóÌæ»»µ±Ç°¶ÔÏó¡£
call([thisObj[,arg1[,
arg2[,   [,.argN]]]]])
²ÎÊý
thisObj  ¿ÉÑ¡Ïî¡£½«±»ÓÃ×÷µ±Ç°¶ÔÏóµÄ¶ÔÏó¡£
arg1, arg2,  , argN
¿ÉÑ¡Ïî¡£½«±»´«µÝ·½·¨²ÎÊýÐòÁС£
  
˵Ã÷
call ·½·¨¿ÉÒÔÓÃÀ´´ú ......

javascriptЧÂʾ­Ñé̸(Ò»)

±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔ­À´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾­Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾­¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷Ô­Òò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ