日期:2014-05-16 浏览次数:20412 次
<script type="text/javascript">
var xpoint,ypoint;
function mousePos(e){
var x,y;
var e = e||window.event;
return {
x:e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,
y:e.clientY+document.body.scrollTop+document.documentElement.scrollTop
};
};
function test(e){
document.getElementById("mjs").innerHTML = mousePos(e).x+','+mousePos(e).y;
xpoint=mousePos(e).x;ypoint=mousePos(e).y;
onclick: expression_r(onclick=function (){alert(xpoint+','+ypoint)});
};
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
window.onload=function()
{
var xpoint=22,ypoint=33;
var xh=document.getElementById('xh');
var yh=document.getElementById('yh');
var oBtn=document.getElementById('btn');
var oForm=document.getElementById('FormS');
oBtn.onclick=function()
{
xh.value=xpoint;//设置值
yh.value=ypoint;
oForm.submit();//提交表单并转向
}
}
</script>
</head>
<body>
<form method="get" action="http://www.baidu.com" id="FormS">
<input type="hidden" name="xpoint" id="xh" />
<input type="hidden" name="ypoint" id="yh"/>
</form>
<input type="button" value="点击开始提交" id="btn"/>
</body>
</html>