IE下可用!FF不行!
<!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>
<title>dhtml.event.dragAnalysis.html</title>
<meta name="generator" content="editplus" />
<meta name="author" content="Gao YiXiang" />
<meta name="email" content="[email protected]" />
<meta name="keywords" content="javascript dhtml dom" />
<meta name="description" content="I love web development." />
</head>
<body>
<a id="hlkDrag" href="aaa.jsp?id=444">drag me</a>
<input id="tbxShow" type="text" id="" />
<script type="text/javascript">
<!--
/*
ondragend 当用户在拖曳操作结束后释放鼠标时在源对象上触发。
ondragenter 当用户拖曳对象到一个合法拖曳目标时在目标元素上触发。
ondragleave 当用户在拖曳操作过程中将鼠标移出合法拖曳目标时在目标对象上触发。
ondragover 当用户拖曳对象划过合法拖曳目标时持续在目标元素上触发。
ondragstart 当用户开始拖曳文本选中区或选中对象时在源对象上触发
*/
function $(sId)
{
return document.getElementById(sId)
}var oTarget = null;
$("tbxShow").ondragover = function()
{
oTarget = this;
};
$("hlkDrag").ondragend = function()
{
if (oTarget)
{
oTarget.value = this.href.substr(this.href.lastIndexOf("?")+1);
}
};
//-->
</script>
</body>
</html>
<!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>
<title>dhtml.event.dragAnalysis.html</title>
<meta name="generator" content="editplus" />
<meta name="author" content="Gao YiXiang" />
<meta name="email" content="[email protected]" />
<meta name="keywords" content="javascript dhtml dom" />
<meta name="description" content="I love web development." />
</head>
<body>
<a id="hlkDrag" href="aaa.jsp?id=444">drag me</a>
<input id="tbxShow" type="text" id="" />
<script type="text/javascript">
<!--
/*
ondragend 当用户在拖曳操作结束后释放鼠标时在源对象上触发。
ondragenter 当用户拖曳对象到一个合法拖曳目标时在目标元素上触发。
ondragleave 当用户在拖曳操作过程中将鼠标移出合法拖曳目标时在目标对象上触发。
ondragover 当用户拖曳对象划过合法拖曳目标时持续在目标元素上触发。
ondragstart 当用户开始拖曳文本选中区或选中对象时在源对象上触发
*/
function $(sId)
{
return document.getElementById(sId)
}var oTarget = null;
$("tbxShow").ondragover = function()
{
oTarget = this;
};
$("hlkDrag").ondragend = function()
{
if (oTarget)
{
oTarget.value = this.href.substr(this.href.lastIndexOf("?")+1);
}
};
//-->
</script>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货