ASP.Net/HTML Control/Image Control

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Displaying an Image through the HTML Image Control (VB.net)

<%@ Page Language=VB Debug=true %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Displaying an Image through the HTMLImage Control</TITLE>
</HEAD>
<BODY>
<form runat="server">
<img
    id="Image1"
    runat="Server"
    src="http://www.nfex.ru/style/download.png"
>
<BR><BR>
<img
    id="Image2"
    runat="Server"
    src="http://www.nfex.ru/style/download.png"
    alt="Picture of a button."
    border="4"
>
<BR><BR>
<img
    id="Image3"
    runat="Server"
    src="http://www.nfex.ru/style/download.png"
    width="300"
    height="300"
>
</form>
</BODY>
</HTML>



Retrieving Clicked Coordinates through the HTML Input Image Control (VB.net)

<%@ Page Language=VB Debug=true %>
<script runat=server>
Sub SubmitBtn_Click(Source As Object, E as ImageClickEventArgs)
    MyMessage.InnerHTML = "Coordinates Clicked<BR><BR>" _
        & "X: " & E.X & "<BR>" _
        & "Y: " & E.Y
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Retrieving Clicked Coordinates through the HTMLInputImage Control</TITLE>
</HEAD>
<BODY>
<form runat="server">
<span
    id="MyMessage"
    runat=server
>
</span>    
<BR><BR>
<input 
    id="ImageButton1"
    runat="server"
    type="image"
    src="http://www.nfex.ru/style/logo.png"
    onserverclick="SubmitBtn_Click" 
>
</Form>
</BODY>
</HTML>



Using the HTML Input Image Control to triger event (VB.net)

<%@ Page Language=VB Debug=true %>
<script runat=server>
Sub SubmitBtn_Click(Source As Object, _
    E as ImageClickEventArgs)
    MyMessage.InnerHTML = "Hello " & YourName.Value
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Using the HTMLInputImage Control</TITLE>
</HEAD>
<BODY>
<form runat="server">
<span
    id="MyMessage"
    runat=server
>
</span>    
<BR>    
Name: <BR>
<input
    id="YourName"
    runat="server"
    type="text"
>
<BR>
<BR><BR>
<input 
    id="ImageButton1"
    runat="server"
    type="image"
    src="http://www.nfex.ru/style/download.png"
    onserverclick="SubmitBtn_Click" 
>
</Form>
</BODY>
</HTML>