HTML代码:
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Show Or Hide</title>
<script type="text/javascript" src="jquery/jquery-1.4.js"></script>
<script type="text/javascript" src="jquery/function.js"></script>
<script type="text/javascript">
$(function(){
imageTestHideOrShow();
});
</script>
</head>
<body>
<img id="image" alt="image" src="img/map2.jpg">
<div><input type="button" name="showhide" id="showhide" value="隐藏"></div>
<textarea style="background-color:yellow;" rows="10" cols="20"></textarea>
</body>
</html>
--------------------------------------------------------------------------------------
JS代码:
function imageTestHideOrShow()
{
var i=1;
$("#showhide").click(function(){
if(i==1){
$("#image").hide("slow");
$("#showhide").val("显示");
i=0;
}else{
$("#image").show("slow");
i=1;
}
});
}本回答被提问者采纳