<html>
<head>
<title>Using Dynamic HTML Events with the ImageButton Control</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server">
void saySomething ( object src, CommandEventArgs e ) {
switch ( e.CommandName ) {
case "earth" :
message.InnerHtml = "You’re probably a down-to-earth person.";
break;
case "venus" :
message.InnerHtml = "Seems like you’d rather be in fiery Venus.";
break;
case "neptune" :
message.InnerHtml = "Maybe you’re the type who’d prefer cooler Neptune.";
break;
}
}
</script>
</head>
<body>
<!-- #include virtual="~/shared/top.inc -->
<div class="header"><h2>Using Dynamic HTML Events with the ImageButton Control</h2></div>
<!-- #include virtual="~/shared/viewsrc_top.inc" -->
<hr size=1 width=92%>
<div align="center">
<form runat="server">
<asp:imagebutton commandname="earth" height=100 width=100
imageurl="~/shared/images/earth.gif"
style="border:thick white ridge"
onMouseOver="this.style.border='thick green groove';"
onMouseOut="this.style.border='thick white ridge';"
onCommand="saySomething" runat="server" />
<asp:imagebutton commandname="venus" height=100 width=100
imageurl="~/shared/images/venus.gif"
style="border:thick white ridge"
onMouseOver="this.style.border='thick green groove';"
onMouseOut="this.style.border='thick white ridge';"
onCommand="saySomething" runat="server" />
<asp:imagebutton commandname="neptune" height=100 width=100
imageurl="~/shared/images/neptune.gif"
style="border:thick white ridge"
onMouseOver="this.style.border='thick green groove';"
onMouseOut="this.style.border='thick white ridge';"
onCommand="saySomething" runat="server" />
<p><span id="message" runat="server">Where do you want to go today?</span>
</form>
</div>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>