<input name="start_price" id="start_price" type="text" size="5" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" />
table居中:
<div align=center valign=middle>
<table>
<tr> <td> 居中 </td> </tr>
</table>
</div>
parseInt()js数字相加
在当前鼠标位置显示div
var mousePos;
function mousePosition(ev){
if(ev.pageX || ev.pageY){
return {x:ev.pageX, y:ev.pageY};
}
return {x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
y:ev.clientY + document.body.scrollTop - document.body.clientTop};
}
//显示出一个层,divId:层id;x:右偏移像素;y:下偏移像素;
function openDiv(divId,x,y){
if(x==null){x=0;}
if(y==null){y=0;}
if(document.getElementById(divId)!=null){
var dvs=document.getElementById(divId).style;
dvs.left=parseInt(mousePos.x)+parseInt(x)+'px';
dvs.top=parseInt(mousePos.y)+parseInt(y)+'px';
dvs.display="block";
}
}
function mouseMove(ev){
ev = ev || window.event;
mousePos = mousePosition(ev);
}
window.document.onmousemove = mouseMove;
联系客服