webform按钮鼠标悬停 [英] webform button mouse hover
问题描述
我有一个带3个按钮和图像控件的网页。
我当我移动3个按钮时,我想在图像控件中显示图像。每个按钮应显示不同的图像。我怎么能这样做?
问候
Scorgi
网上有很多关于如何翻转图像的例子。例如,这是我在谷歌搜索中的第一个:
http://helplogger.blogspot.com/2012/05/create-rollover-image-effect-change.html [ ^ ]
< blockquote><!DOCTYPE html>
< html xmlns =http://www.w3.org/1999/xhtml>
< head runat =server>
< title>< / title>
< script type =text / javascript> ;
函数showimage1(){
document.getElementById(Image1)。style.display =inline;
document.getElementById (Image1)。src ='add_icon.png';
}
//您也可以为其他按钮编写
函数hideimage(){
document.getElementById(Image1)。style.display =none;
}
< / script>
< ; / head>
< body>
< form id =form1runat =server>
< asp:Button ID =Button1runat =serverText =Buttononmouseover =showimage1(); onmouseout =hideimage()/>
< asp:图片ID =Image1runat =server/>
< / form>
< / body>
< / html>
Hi,
I have a webform with 3 buttons and an image control.
I would like to show an image in the image control when I move the over the 3 buttons. Each button should show a different image. How can I do that?
Regards
Scorgi
Lots of examples online on how to to rollover images. For example, this is the first from a google search I did:
http://helplogger.blogspot.com/2012/05/create-rollover-image-effect-change.html[^]
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function showimage1() {
document.getElementById("Image1").style.display = "inline";
document.getElementById("Image1").src = 'add_icon.png';
}
//you can write for other buttons as well
function hideimage() {
document.getElementById("Image1").style.display = "none";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" onmouseover="showimage1();" onmouseout="hideimage()"/>
<asp:Image ID="Image1" runat="server" />
</form>
</body>
</html>
这篇关于webform按钮鼠标悬停的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!