Javascript ȡСÊýµãºóÃæNλ
ÓÃJavascriptÈ¡floatÐÍСÊýµãºóÁ½Î»£¬Àý22.127456È¡³É22.13,ÈçºÎ×ö£¿
1. ×µÄ°ì·¨....... [ÎÒ¾ÍÔõô¸ÉµÄ.........]
1function get()
2{
3 var s = 22.127456 + "";
4 var str = s.substring(0,s.indexOf(".") + 3);
5 alert(str);
6}
2. ÕýÔò±í´ïʽЧ¹û²»´í
1<script type="text/javascript">
2onload = function(){
3 var a = "23.456322";
4 var aNew;
5 var re = /([0-9]+\.[0-9]{2})[0-9]*/;
6 aNew = a.replace(re,"$1");
7 alert(aNew);
8}
9</script>
3. Ëû¾Í±È½Ï´ÏÃ÷ÁË.....
1<script>
2var num=22.127456;
3alert( Math.round(num*100)/100);
4</script>
4.»áÓÃÐÂÏʶ«Î÷µÄÅóÓÑ....... µ«ÊÇÐèÒª IE5.5+²ÅÖ§³Ö¡£
1 <script>
2var num=22.127456;
3alert( num.toFixed(2));
4</script>
Ïà¹ØÎĵµ£º
//ת»»ÎªUNIXʱ¼ä´Á
function strtotimestamp(datestr)
{
var new_str = datestr.replace(/:/g,"-");
new_str = new_str.replace(/ /g,"-");
var arr = new_str.split("-");
var datum = new Date(Date. ......
a href="#"> µã»÷Á´½Óºó£¬Ò³Ãæ»áÏòÉϹöµ½Ò³Ê×£¬# ĬÈÏêµãΪ #TOP
<a href="javascript:void(0)" onClick="window.open()"> µã»÷Á´½Óºó£¬Ò³Ãæ²»¶¯£¬Ö»´ò¿ªÁ´½Ó
<a href="#" onclick="javascript:return false;"> ×÷ÓÃͬÉÏ£¬²»Í¬ä¯ÀÀÆ÷»áÓвîÒì¡£
µã»÷Á´½Óºó£¬²»ÏëÊ¹Ò³Ãæ¹öµ½Ò³Ê×£¬¾ÍÓÃhref="javascript:v ......
<html>
<head>
<title>test javaScript</title>
//cssÉèÖÃͼÏñµÄ͸Ã÷¶È
<mce:style><!--
img
{
filter:alpha(opacity=10)
}
--></mce:style><style mce_bogus="1">img
{
filter:alpha(opacity=10)
}</style>
<mce:script type="text/javasc ......
ÔÚÉÏÃæµÄʾÀýÖУ¬ÎÒÃǶ¨ÒåÁËÁ½¸öÓï·¨¸Ê¶£¬Ò»¸öÊÇClass()º¯Êý£¬Ò»¸öÊÇNew()º¯Êý¡£Ê¹ÓÃClass()¸Ê¶£¬ÎÒÃÇÒѾ¿ÉÒÔÓ÷dz£ÓÅÑŵĸñʽ¶¨ÒåÒ»¸öÀà¡£ÀýÈçǰÀýÖеģº
var
Employee
=
Class(Person,
//
ÅÉÉúÖÁPersonÀà
{
......
¿Í»§¶Ë¶¯Ì¬Êä³ötableÊý¾Ý²¢Õ¹Ê¾±í¸ñ£¬ÊÇwebÓ¦ÓÃÖнÏΪ³£¼ûµÄ¹¤×÷¡£¶ÔÓÚÑ»·´òÓ¡Êä³ötr£¬td±¾ÉíÊÇÒ»¼þ·Ç³£½©Ó²ºÍ±©Á¦µÄ±à³Ì°ì·¨£¬ÔÙ¼ÓÉÏ×îºó°ó¶¨ÔªËØinnerHTML×Ö·ûÁ÷Êä³ö£¬
¡¡¡¡ÏµÍ³ËùÏûºÄµÄÐÔÄÜ´ú¼ÛÊǷdz£¸ß°ºµÄ£¬Èç¹ûÎÒÃÇÐèÒªÕ¹ÏÖµÄÊý¾Ý·Ç³£ÅÓ´óʱ£¬ÄÇô´ú¼ÛÒ²Êdzɱ¶µÄ¡£È»¶øÕâÖÖ¶¯Ì¬Êä³ö±í¸ñµÄ·½·¨ÊÇ´ó¶àÊý¿Í»§¶Ë³ÌÐòÔ ......