用javascript实现在小方框中浏览大图的代码_Javascript教程-查字典教程网
用javascript实现在小方框中浏览大图的代码
用javascript实现在小方框中浏览大图的代码
发布时间:2016-12-30 来源:查字典编辑
摘要:无标题文档今天在玩googleearth4.0b,发现PrintScreen下来的图片很大,如果直接放在网页上,因为尺寸太大又不合适,又不想...

<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<head>

<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>

<title>无标题文档</title>

<styletype="text/css">

<>

</style>

<scripttype="text/javascript">

<>

</script>

</head>

<body>

<divid="pic"onmousedown="getmouseposition(event)"onmouseup="setmouseposition(event)"></div>

今天在玩googleearth4.0b,发现PrintScreen下来的图片很大,如果直接放在网页上,因为尺寸太大又不合适,又不想压缩图片的尺寸,于是乎就想到了这种方法,没想到实现起来比预想的要容易。呵呵,该死的是,这段代码还兼容firefox。

</body>

</html>

今天在玩googleearth4.0b,发现PrintScreen下来的图片很大,如果放在网页不合适,又不想压缩图片的尺寸,于是乎就想到了这种方法,没想到实现起来比预想的要容易。呵呵,该死的是,这段代码还兼容firefox。

--------------------------------------------------------------------------------------

2006.6.20修改:

·添加了滚动的范围,不会出现背景

·用到onmousemove事件,图片实时随鼠标移动而移动

<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<head>

<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>

<title>无标题文档</title>

<styletype="text/css">

<>

</style>

<scripttype="text/javascript">

<>

</script>

</head>

<body>

<divid="pic"onmousedown="getmouseposition(event)"onmousemove="movestart(event)"onmouseup="movestop()"onmouseout="movestop()"></div>

</body>

</html>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新Javascript教程学习
    热门Javascript教程学习
    编程开发子分类