`
sxdtzhaoxinguo
  • 浏览: 213573 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

查看商品图片,鼠标悬浮图片放大js实现

 
阅读更多

2010-06-07 10:18:46|分类:Javascript|字号订阅

<%@pagelanguage="java"import="java.util.*"pageEncoding="UTF-8"%>

<%@pageimport="com.pojo.Products"%>

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

<!DOCTYPEHTMLPUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<basehref="<%=basePath%>">

<title>My JSP 'buy.jsp' starting page</title>

</head>

<scripttype="text/javascript">

functionshowing(imgpath){

varx=event.clientX;

vary=event.clientY;

document.getElementById("popup").innerHTML="<img src='"+imgpath+"' width=200 height=200 />";

document.getElementById("popup").style.top=y+50;

document.getElementById("popup").style.left=x;

document.getElementById("popup").style.visibility="visible";

}

functionclearing(){

document.getElementById("popup").style.visibility="hidden";

}

</script>

<body>

<%

Products p=(Products)request.getAttribute("procduct");

%>

商品名称:<%=p.getName()%><br/>

会员价:<%=p.getSaleprice()%><br/>

图片:<imgalt=""src="<%=p.getImange()%>"vspace="6"border="0"onmouseover="showing('<%=p.getImange()%>');"onmouseout="clearing();"><br/>

商品描述:<br/>

<textarearows="3"cols="15"disabled="disabled">

<%=p.getDescript()%>

</textarea>

<formaction="">

数量:<inputname="count"size="2">

<inputtype="submit"value="购买">

</form>

<divstyle="position: absolute; width:200; height:200; border:solid 1px; border-color: red; visibility: hidden; "id="popup">

123457789

</div>

<br/>

<br/>

<br/>

<ahref="index.jsp?sid=<%=p.getSortp().getId()%>">返回商品列表</a>

</body>

</html>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics