Please visit our sponsors !
HtmlGeneric Control
Definition and Usage
The HtmlGeneric control is used to control other HTML element not
specified by a specific HTML server control, like <body>, <div>, <span>, <font>,
etc.
Properties
Property |
Description |
id |
A unique id for the control |
InnerHtml |
The HTML content of this element |
InnerText |
The text-only content of this element |
runat |
Specifies that the control is a server control. Must
be set to "server" |
Visible |
A Boolean value that indicates whether the element should be visible
or not |
Example 1
In the following example we declare two HtmlInputText
controls, one HtmlInputButton
control, and one HtmlGeneric control in an .aspx file (remember to embed the controls
inside an HtmlForm control). When the submit button is triggered, the submit subroutine is executed. The
submit subroutine may respond in two ways: if the user has entered Batman and
Robin as user name and password, the server sends the message "Correct user name
and password!" to the span control. If the user enters another name or password,
the server sends the message "Incorrect user name or password!" to the span
control:
<script runat="server">
Sub submit(sender As Object, e as EventArgs)
if (name.value="Batman") and (pws.value="Robin") then
s1.InnerHtml="Correct user name and password!"
else
s1.InnerHtml="Incorrect user name or password!"
end if
End Sub
</script>
<html>
<body>
<form runat="server">
Username: <input id="name" type="text" size="25"
runat="server" />
<br />
Password: <input id="pws" type="password" size="8"
runat="server" />
<br /><br />
<input type="submit" value="Log In" OnServerClick="submit"
runat="server" />
<h3><span id="s1" runat="server" /></h3>
</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
|