2个imagebutton(imagebutton1,imagebutton2)
首先给2个imagebutton都赋好图片了,我现在想,点击imagebutton1的时候,就把它本身的图片从1.gif换到2.gif
点击imagebutton2时,imagebutton1的图片变为1.gif,同时imagebutton2本身的图片从3.gif换到4.gif
如此循环(多个imagebutton时).并且imagebutton还要实现跳转或提交的事件。
图片的更换用js怎么实现?
首先给2个imagebutton都赋好图片了,我现在想,点击imagebutton1的时候,就把它本身的图片从1.gif换到2.gif
点击imagebutton2时,imagebutton1的图片变为1.gif,同时imagebutton2本身的图片从3.gif换到4.gif
如此循环(多个imagebutton时).并且imagebutton还要实现跳转或提交的事件。
图片的更换用js怎么实现?
解决方案 »
- 求帮助,中木马,UpdatedPage=aGlqYWNr 网站所有页面都有这个代码。
- 实体类是bool型如何在页面显示汉字?
- mvc下面如何用富文本编辑器 如DotNetTextBox.dll等?
- ASP.net入门疑问,究竟怎么用VS2005这个工作做ASP.NET程序呢?
- 如何能生成透明背景的验证码?
- 请问 如何 快度 清空 datagrid 中的数据?????????????????????
- 一个看似简单却没有办法解决的问题!高手顶下!
- 关于 动态框架 的处理
- 后台代码指定控件ID,查看源文件后ID中特殊字符自动转换了?
- asp.NET中 如何在前台显示一条记录
- webservice獲取客戶端ip
- Server2003 IIS “/”应用程序中的服务器错误。
imagebutton1.ImageUrl="~/路径/文件名"
我看很多网站都能这样实现,点击按钮,按钮就凹下去了,下面的页面就刷新了
ajax才是局部刷新的。如果刷新页面,做法是不同的。下面是一种做法<%@ Page Language="C#" Debug="true" %><!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 runat="server">
<title></title>
<script>
function SetImage(o) {
o.src = o.getAttribute("OldImage");
SetCookie("id", o.id)
} function SetCookie(cookieName, cookieValue) {
var today = new Date();
var expire = new Date();
expire.setTime(today.getTime() + 1000 * 60 * 60 * 24 * 1);
document.cookie = cookieName + "=" + escape(cookieValue) + ";expires=" + expire.toGMTString();
} function GetCookie(cookieName) {
var theCookie = "" + document.cookie;
var ind = theCookie.indexOf(cookieName);
if (ind == -1 || cookieName == "")
return "";
var ind1 = theCookie.indexOf(';', ind);
if (ind1 == -1)
ind1 = theCookie.length;
return unescape(theCookie.substring(ind + cookieName.length + 1, ind1));
}
window.onload = function () {
if (GetCookie("id") != "") document.getElementById(GetCookie("id")).src = document.getElementById(GetCookie("id")).getAttribute("OldImage");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ImageButton ID="ImageButton1" runat="server" Height="53px" Width="189px" OnClientClick="SetImage(this)"
OldImage="2.gif" ImageUrl="1.gif" />
<asp:ImageButton ID="ImageButton2" runat="server" OldImage="http://dotnet.aspx.cc/Images/qrcode.png"
ImageUrl="http://dotnet.aspx.cc/Images/logoSite.gif" Height="53px" Width="189px"
OnClientClick="SetImage(this);return false" />
</form>
</body>
</html>
同时imagebutton图片更换(客服端)