JavaScript±í¸ñÅÅÐò
´ËÀý×ÓÊÇjavascript¸ß¼¶³ÌÐòÉè¼ÆÀïµÄ
·Å³öÀ´Ðı¸ÒÔºóʹÓá£ÉÏ´úÂë¡£
<html>
<head>
<title>Table Sort Example</title>
<mce:script type="text/javascript"><!--
function convert(sValue, sDataType) {
switch(sDataType) {
case "int":
return parseInt(sValue);
case "float":
return parseFloat(sValue);
case "date":
return new Date(Date.parse(sValue));
default:
return sValue.toString();
}
}
function generateCompareTRs(iCol, sDataType) {
return function compareTRs(oTR1, oTR2) {
var vValue1, vValue2;
if (oTR1.cells[iCol].getAttribute("value")) {
vValue1 = convert(oTR1.cells[iCol].getAttribute("value"),
sDataType);
vValue2 = convert(oTR2.cells[iCol].getAttribute("value"),
sDataType);
} else {
vValue1 = convert(oTR1.cells[iCol].firstChild.nodeValue,
sDataType);
vValue2 = convert(oTR2.cells[iCol].firstChild.nodeValue,
sDataType);
}
if (vValue1 < vValue2) {
return -1;
} else if (vValue1 > vValue2) {
return 1;
} else {
Ïà¹ØÎĵµ£º
// È¥µô×Ö·û´®×ó±ß¿Õ¸ñ
function trimToLeft(str){
var i;
for(i=0;i<str.length; i++) {
if(str.charAt(i)!=" ") break;
......
±¾ÎÄ×÷ÕßΪDavid
Mandelin£¬©¤©¤Mozilla JavaScriptÍŶӹ¤×÷ÈËÔ±¡£
Firefox 3.5ÓµÓÐÒ»¸öȫеÄJavaScriptÒýÇæ£¬½Ð×öTraceMonkey£¬ÔÚ¸ÃÒýÇæÉÏÅÜJSÓ¦ÓÃÒª±ÈFirefox
3¿ìµ½3-4±¶£¬´Ó¶øÎªÏÖÓеÄÍøÂçÓ¦ÓüÓËÙ¡£ÕâÆªÎÄÕ´óÖµÄÃèÊöÒ»ÏÂÔÚTraceMonkeyÖаüÀ¨µÄÖØÒª²¿¼þ£¬ÒÔ¼°ËûÃÇÊÇÈçºÎ¼ÓËÙJavaScriptµÄ¡£Í¬Ñù£¬ÔÚÁ˽âÕâÐ ......
ÎÒÃÇÓÐʱ»ñÈ¡ styl.widthΪ¿ÕµÄʱºò£¬¿ÉÒÔ»ñÈ¡cssÖеÄwidth..
µ«ie and ff ÊDz»Í¬µÄ¡£¡£
ie:
obj.currentStyle['width']
ff:
var css = document.defaultView.getComputedStyle(obj, null);
css.getPropertyValue('width') ......
µÚÒ»²½£ºÔÚIEµÄ“InternetÉèÖÔÖÐÑ¡Ôñ“¸ß¼¶”——“°²È«”——“ÆôÓü¯³ÉwindowsÉí·ÝÑéÖ¤”¡£
µÚ¶þ²½£ºÔÚÐèÒªµ÷ÊÔµÄÒ³ÃæµÄ½Å±¾ÖмÓÉÏdebugger; È»ºóÔËÐÐÕâ¸öÒ³Ãæ£¬¾Í»áÔÚÕâÀïÍ£ÏÂÀ´
ÀýÈ磺
function BtnSubmit_Click()
{
var aaa;
aaa='aaa';
debugg ......
ÑÝʾµØÖ·: http://www.wowo-design.com/view/51_01/index.htm
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>css²Ëµ¥ÑÝʾ</title>
<style type="text/css">
<!--
*{margin:0;padding:0;border:0;}
body {
......