Please visit our sponsors !
HtmlButton Control
Definition and Usage
The HtmlButton control is used to control a <button> element. In HTML, the <button>
element is used to create a push button.
Properties
Property |
Description |
id |
A unique id for the control |
OnServerClick |
The name of the function to be executed when the button is
clicked |
runat |
Specifies that the control is a server control. Must
be set to "server" |
Example 1
In the following example we declare two HtmlButton
controls in an .aspx file (remember to embed the control
inside an HtmlForm control). Next, write an event handler that specifies what to happen when a button is
clicked:
<script runat="server">
Sub b1_OnClick(Source As Object, e As EventArgs)
s1.InnerHtml="You clicked Button1"
End Sub
Sub b2_OnClick(Source As Object, e As EventArgs)
s1.InnerHtml="You clicked Button2"
End Sub
</script>
<html>
<body>
<form runat="server">
<button id="b1"
OnServerClick="b1_OnClick"
style="background-color:lightgreen;
height=30;width:100"
runat="server">
Click me!
</button>
<button id=b2
OnServerClick="b2_OnClick"
style="background-color:yellow;
height=30;width:100"
runat="server">
Click me too!
</button>
<span id="s1" runat="server"/>
</form>
</body>
</html>
|
Jump to: Top of Page
or HOME or
Printer friendly page
Search W3Schools:
What Others Say About Us
Does the world know about us? Check out these places:
Dogpile
Alta Vista
MSN
Google
Excite
Lycos
Yahoo
Ask Jeeves
We Help You For Free. You Can Help Us!
W3Schools is for training only. We do not warrant its correctness or its fitness for use.
The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our
terms of use and
privacy policy.
Copyright 1999-2002 by Refsnes Data. All Rights Reserved
|