to net_lover(孟子E章) 

wwl007 2001-05-22 10:30:00
例子:
<body leftmargin=0 topmargin=0>
<img id=mxh2 src="http://lucky.myrice.com/logo.gif" width=468 height=60><br>
<img id=mxh src="http://lucky.myrice.com/logo.gif" width=468 height=60>
<script>
function test(){
alert("图片2的 Top = "+document.all.mxh.offsetTop+"\n\n"+"图片2的 Left = "+document.all.mxh.offsetLeft)
}
</script>
<br>
<a href="#" onclick="test()">test</a>

我如何把其放在一个变量中
因为我仅仅能过用alert弹出!但是不能真正的付给一个便量!
我想知道这个值是什么类型!
...全文
48 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
cexo_wxf_ss 2001-05-23
  • 打赏
  • 举报
回复
孟子E章進給你分去說一句話了,我要給分給你, 我在你回答問題中給不了, 因為我自己發表了二句,第二次就不能給分了.哈哈,進給你分,我隨便說一句了. (cexo_wxf_ss)
孟子E章 2001-05-22
  • 打赏
  • 举报
回复
style="position:relative;"
是相对的
wwl007 2001-05-22
  • 打赏
  • 举报
回复
为什么这样得到坐标的相对位置!和用<img id=map src="bigmap.gif" style="position:relative;" contextmenu="demob">得得到的不一样!
孟子E章 2001-05-22
  • 打赏
  • 举报
回复
<body leftmargin=0 topmargin=0>
<img id=mxh2 src="http://lucky.myrice.com/logo.gif" width=468 height=60><br>
<img id=mxh src="http://lucky.myrice.com/logo.gif" width=468 height=60>
<script>
function test(){
var pic2top=document.all.mxh.offsetTop;
alert("document.all.mxh.offsetTop 已经赋值给 pic2top .\n\npic2top 类型是: "+typeof(pic2top));
aa.value=pic2top
}
</script>
<br>
<a href="#" onclick="test()">测试</a> <br>
<input type=text name=aa>

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧