JavaScriptʵÏÖGridViewÏàͬÐеĺϲ¢
ÏÈ¿´Ð§¹û£¬ºÏ²¢Ç°£º
ºÏ²¢ºó£º
ʵÏÖÔ´Â룺
// ******************************
//¹¦ÄÜ£ºÓû§ºÏ²¢GridViewÏàͬµÄÐÐ(ǰ̨ÏÔʾµÄʱºòºÏ²¢)
//ʱ¼ä£º2009/08/12 14:59
//×÷ÕߣºYzy
// ******************************
//²ÎÊý˵Ã÷£ºstrGridId—Êý¾Ý¿Ø¼þÃû³Æ£»arrIndexCol—²»Çå³þ£»arrMergeCol—ÒªºÏ²¢µÄÁÐË÷Òý(´Ó0¿ªÊ¼)£»
// blHasHeader—±íÍ·ÊÇ·ñ²ÎÓëºÏ²¢£»blHasFooter—±í½ÅÊÇ·ñ²ÎÓëºÏ²¢£»blHasPageLine—ÊÇ·ñ±£Áô×îºóÒ»ÐÐÊý¾Ý²»²ÎÓëºÏ²¢
function fcnAthosColumnMerge(strGridId, arrIndexCol, arrMergeCol, blHasHeader, blHasFooter, blHasPageLine)
{
var tbl = document.all[strGridId];
var iH = 0;
var iF = 0;
if(blHasHeader == true) iH++;
if(blHasFooter == true) iF++;
if(blHasPageLine == true) iF++;
tRows = tbl.children[0].children;
i0 = iH;
strKey = new Array(arrIndexCol.length);
strPrevKey = new Array(arrIndexCol.length);
for(ii=0; ii<arrIndexCol.length;ii++)
{
strKey[ii] = tRows[iH].children[arrIndexCol[ii]].innerText;
strPrevKey[ii] = strKey[ii];
}
for(i=iH+1;i<tRows.length-iF;i++)
{
blEqual = true;
for(ii=0; ii<arrIndexCol.length;ii++)
{
strKey[ii] = tRows[i].children[arrIndexCol[ii]].innerText;
if(strKey[ii] != strPrevKey[ii])
blEqual = false;
}
if(blEqual == false)
{
for(ii=0;ii<arrMergeCol.length;ii++)
tRows[i0].children[arrMergeCol[ii]].rowSpan = i-i0;
for( j=i0+1; j<i; j++)
for(ii=arrMergeCol.length-1;ii>=0;ii--)
tRows[j].children[arrMergeCol[ii]].removeNode(true);
i0 = i;
for(ii=0;ii<strKey.length;ii++)
strPrevKey[ii] = strKey[ii];
}
}
for(ii=0;ii<arrMergeCol.length;ii++)
tRows[i0].children[arrMergeCol[ii]].rowSpan = i-i0;
for( j=i0+1; j<i; j++)
for(ii=arrMergeCol.length-1;ii>=0;ii--)
tRows[j].children[arrMergeCol[ii]].removeNode(true);
return;
}
//º¯Êýµ÷ÓÃDemo£¨ºÏ
Ïà¹ØÎĵµ£º
±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔÀ´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷ÔÒò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......
JavaScriptÊÇ»ùÓÚ¶ÔÏóµÄ£¬ÈκÎÔªËض¼¿ÉÒÔ¿´³É¶ÔÏó¡£È»¶ø£¬ÀàÐͺͶÔÏóÊDz»Í¬µÄ¡£±¾ÎÄÖУ¬ÎÒÃdzýÁËÌÖÂÛÀàÐͺͶÔÏóµÄһЩÌصãÖ®Í⣬¸üÖØÒªµÄÊÇÑо¿ÈçºÎд³öºÃµÄ²¢ÇÒÀûÓÚÖØÓõÄÀàÐÍ¡£±Ï¾¹£¬JavaScriptÕâÖÖÁ÷ÐеĽű¾ÓïÑÔÈç¹ûÄܹ»½øÐÐÁ¼ºÃµÄ·â×°£¬²¢ÐγÉÒ»¸öÅÓ´óµÄÀàÐͿ⣬¶ÔÓÚÖØÓÃÊǷdz£ÓÐÒâÒåµÄ¡£
ÍøÉ϶ÔÓÚprototypeµÄÎÄÕ弆 ......
±¾ÎļòÒª½éÉÜJavaScriptÖÐconfirm,alert,promptµÄÓ÷¨,Ï£Íû´ó¼Òѧϰ¹ý³ÌÖÐÄܵõ½Ò»Ð©Æô·¢¡£
window.confirm ²ÎÊý¾ÍÖ»ÓÐÒ»¸ö¡£ÏÔʾÌáʾ¿òµÄÐÅÏ¢¡£°´È·¶¨,·µ»Øtrue£»°´È¡Ïû·µ»Øfalse¡£
< SCRIPT> var bln = window.confirm("È·¶¨Âð?"); alert(bln) < /SCRIPT> window.alert²ÎÊý£¬Ö»ÓÐ ......
ʹÓùýajaxµÄ¶¼³£¼ûÕâÑùµÄ´úÂ룺
<a href="javascript:doTest2();void(0);" mce_href="javascript:doTest2();void(0);">here</a>
µ«Õâ¶ùµÄvoid(0)¾¿¾¹ÊǺκ¬ÒåÄØ£¿
JavascriptÖÐvoidÊÇÒ»¸ö²Ù×÷·û£¬¸Ã²Ù×÷·ûÖ¸¶¨Òª¼ÆËãÒ»¸ö±í´ïʽµ«ÊDz»·µ»ØÖµ¡£
void ²Ù×÷·ûÓ÷¨¸ñʽÈçÏ£º
1. jav ......