保留小数点 的位数(四舍五入)
toFixed(n) : 参数 n 保留的位数
转换为数字
Number(n) : 参数 n 要转换的对象
判断非法字符
isNaN(n) :参数 n 判断对象
选择上传图片出预览效果的JS :
<input id="file_index" runat="server" type="file" onpropertychange="javascript:showImg(this);" />
程序
function showImg(path)
{
var upload=path;
document.getElementById("Image1").src=upload.value;
}
判断是否为空null
isNull(n):参数 n判断对象
注意:在JS语言中如下是错误的 判断 if(n==null)执行...
正确判断 if(isNull(n)) 执行...
JS弹出式网页(如果不关闭此页,无法进行下一步)
var retval = window.showModalDialog('要弹出的页面.htm', null, 'dialogWidth:250px;dialogHeight: 440px;help:0;scroll:0;status:0');
浙公网安备 33010602011771号