我想在页面里放一个小图片,单击的时候出现一个窗口正好显示图片的原始大小.最好有代码我是个初学者请说细点谢谢!!
解决方案 »
- 关于Ext.onready函数
- 有关js锁定页面急~~~~~~~~~~~~!
- 下面这个正则式啥意思啊??? Eaeflnr <--这是啥玩意????
- JAVASCRIPT不间断滚动问题?
- 如何实现文本框按保存按钮自动保存内容到TXT文件?
- javascript 循环的问题!
- 请教一个innerhtml的问题,急,帮忙!!!!!!
- String对象的valueOf方法怎么用?哪位老大给我一个例子?
- 如何用o.insertBefore实现o.insertAdjacentElement("AfterBegin", someObject)
- 各位,救救我!
- javascript 英文原版书 问题 英文好的进啊!
- extjs的回车问题
window.open设他的width,height 为图片的大小就是
<!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=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function GetImgSize(obj)
{
var BigImg=new Image()
BigImg.src=obj.src
return{w:BigImg.width,h:BigImg.height}
}
function ShowBigImg(obj)
{
var imgsizeTemp=GetImgSize(obj)
alert(imgsizeTemp.w+imgsizeTemp.h)
var imgboxTemp=document.createElement('div')
imgboxTemp.id='imgbox'
imgboxTemp.setAttribute('id','imgbox')
document.body.appendChild(imgboxTemp)
imgboxTemp=document.getElementById('imgbox')
imgboxTemp.style.position='absolute'
imgboxTemp.style.zIndex='1000'
imgboxTemp.style.backgroundColor="#ddd"
imgboxTemp.style.width=document.all?imgsizeTemp.w:imgsizeTemp.w+'px'
imgboxTemp.style.height=document.all?imgsizeTemp.h:imgsizeTemp.h+'px'
imgboxTemp.style.left=document.all?obj.offsetWidth:obj.offsetWidth+'px'
imgboxTemp.style.top=document.all?obj.offsetHeight:obj.offsetHeight+'px'
imgboxTemp.innerHTML="<img src='"+obj.src+"' />"
}
</script>
</head>
<body>
<img src='http://image.ieche.com/8/1325/2007-7-12/8G4244K2DD8KHHH1H8.jpg' width='60px' height='60px' onclick='ShowBigImg(this)' />
</body>
</html>