如何用js实现图像的放大缩小啊? 放大10%:imgElement.width = imgElement.offsetWidth * 1.10 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用javaSript 怎么实现呢?不好意思啊,我还是不懂得。你上边写的代码该如何来运用。能不能给一个具体的例子呢?拜托大家了。我刚开始学,请多多指教。 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><TITLE> New Document </TITLE><meta http-equiv="content-type" content="text/html" charset="utf-8"><link rel="stylesheet" type="text/css" href=""><script type="text/javascript" src=""></script><script language="javascript" type="text/javascript"> function enlarge(id) { var node = document.getElementById(id); var width = node.getAttribute("width"); var height = node.getAttribute("height"); node.setAttribute("width",width+10); node.setAttribute("height",height+10); } function shrink(id) { var node = document.getElementById(id); var width = node.getAttribute("width"); var height = node.getAttribute("height"); node.setAttribute("width",width-10); node.setAttribute("height",height-10); }</script></HEAD><BODY><button onclick="enlarge('image');return true;">放大</button><button onclick="shrink('image');return true;">缩小</button><br/><br/><img id="image" src="./image/image1.gif"><!--准备一张图片,路径自己把握--></BODY></HTML>lucky around U. 这个只能针对一张固定的图片。如果我图片的路径是通过后台servlet来获取:显示图片的jsp如下:<img src="../<%=imageInfo.getImageURL()%>" width="<%=imageInfo.getImageWidth()%>" height="<%=imageInfo.getImageHeight()%>"/>触发servlet的jsp如下:<input type="image" src="icon/EnlargeNormal.gif" alt="拡大通常" onclick=""><input type="image" src="icon/ReduceNormal.gif" alt="縮小通常" onclick="">我该如何写onclick=""? 看看我的网站,http://www.sgbuy.net 里产品大图的观看!用javascript实现的。感觉好的话,说声。呵呵! ext中treepanel点击某个节点时候 动态加载对应的js并且激活js中的panel 可以向上移动一个,但是第二个怎么移?? 一个特殊字符转义的问题 如何控制SELECT的背景图片 javascript代码求助 请帮忙解释一段js代码 用Javascript怎样实现一个时钟? javascript表单提交问题 在打开页面编辑模式下怎样改变鼠标的形状 这样的事能做到吗? 那位师兄师姐能帮个忙解决----网页最大化后图片上的文字错位问题!! 数组成员定位问题?
拜托大家了。我刚开始学,请多多指教。
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta http-equiv="content-type" content="text/html" charset="utf-8">
<link rel="stylesheet" type="text/css" href="">
<script type="text/javascript" src=""></script>
<script language="javascript" type="text/javascript">
function enlarge(id)
{
var node = document.getElementById(id);
var width = node.getAttribute("width");
var height = node.getAttribute("height");
node.setAttribute("width",width+10);
node.setAttribute("height",height+10);
} function shrink(id)
{
var node = document.getElementById(id);
var width = node.getAttribute("width");
var height = node.getAttribute("height");
node.setAttribute("width",width-10);
node.setAttribute("height",height-10);
}
</script>
</HEAD><BODY>
<button onclick="enlarge('image');return true;">放大</button><button onclick="shrink('image');return true;">缩小</button><br/><br/>
<img id="image" src="./image/image1.gif"><!--准备一张图片,路径自己把握-->
</BODY>
</HTML>
lucky around U.
显示图片的jsp如下:
<img src="../<%=imageInfo.getImageURL()%>" width="<%=imageInfo.getImageWidth()%>" height="<%=imageInfo.getImageHeight()%>"/>触发servlet的jsp如下:
<input type="image" src="icon/EnlargeNormal.gif" alt="拡大通常" onclick="">
<input type="image" src="icon/ReduceNormal.gif" alt="縮小通常" onclick="">
我该如何写onclick=""?