¹ØÓÚjavascriptСÊýµÄËÄÉáÎåÈë
ÓÃJavascriptÈ¡floatÐÍСÊýµãºóÁ½Î»£¬Àý22.127456È¡³É22.13,ÈçºÎ×ö£¿
1. ×µÄ°ì·¨....... [ÎÒ¾ÍÔõô¸ÉµÄ.........]
function get()
{
var s = 22.127456 + "";
var str = s.substring(0,s.indexOf(".") + 3);
alert(str);
}
2. ÕýÔò±í´ïʽЧ¹û²»´í
<script type="text/javascript">
onload = function(){
var a = "23.456322";
var aNew;
var re = /([0-9]+\.[0-9]{2})[0-9]*/;
aNew = a.replace(re,"$1");
alert(aNew);
}
</script>
3. Ëû¾Í±È½Ï´ÏÃ÷ÁË.....
<script>
var num=22.127456;
alert( Math.round(num*100)/100);
</script>
4.»áÓÃÐÂÏʶ«Î÷µÄÅóÓÑ....... µ«ÊÇÐèÒª IE5.5+²ÅÖ§³Ö¡£
<script>
var num=22.127456;
alert( num.toFixed(2));
</script>
Ïà¹ØÎĵµ£º
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¡¢Êý×éµÄ´´½¨
var arrayObj = new Array();¡¡//´´½¨Ò»¸öÊý×é
var arrayObj = new Array([size]);¡¡//´´½¨Ò»¸öÊý×é²¢Ö¸¶¨³¤¶È£¬×¢Òâ²»ÊÇÉÏÏÞ£¬Êdz¤¶È
var arrayObj = new Array([element0[, element1[, ...[, elementN]]]]);¡¡´´½¨Ò»¸öÊý×é²¢¸³Öµ
Ҫ˵Ã÷µÄÊÇ£¬ËäÈ»µÚ¶þÖÖ·½·¨´´½¨Êý×éÖ¸¶¨Á˳¤¶È£¬µ«Êµ¼ÊÉÏËùÓ ......
Javascript½âÒÉ
1. HTML¿ò¼ÜframesetµÄÓ¦ÓÃ
¿ò¼Ü±à³Ì¸ÅÊöÒ»¸öHTMLÒ³Ãæ¿ÉÒÔÓÐÒ»¸ö»ò¶à¸ö×Ó¿ò¼Ü£¬ÕâЩ×Ó¿ò¼ÜÒÔ<iframe>À´±ê¼Ç£¬ÓÃÀ´ÏÔʾһ¸ö¶ÀÁ¢µÄHTMLÒ³Ãæ¡£ÕâÀïËù½²µÄ¿ò¼Ü±à³Ì°üÀ¨¿ò¼ÜµÄ×ÔÎÒ¿ØÖÆÒÔ¼°¿ò¼ÜÖ®¼äµÄ»¥Ïà·ÃÎÊ£¬ÀýÈç´ÓÒ»¸ö¿ò¼ÜÖÐÒýÓÃÁíÒ»¸ö¿ò¼ÜÖеÄJavaScript± ......
Ö÷Òªº¯Êý CallJScript
BOOL CallJScript(const wchar_t * func, VARIANT * vtParams, int cNumberOfParam, VARIANT * vtResult)
{
if(!func || !func[0])
return FALSE;
CComPtr<IDispatch> spScript;
spScript = GetJScript();
if(!spScript)
return FALSE;
DISPID dispID = NULL;
CC ......