- HTML Image Web Server Control
In ASP.NET environment,This article describes you how to work with HTML Image Control.In
HTML environment, Image is an object that represents an embedded Image in an HTML
form. The Image control in a HTML form contains all instance of an <img> tag.
The HTML Image control can be used to rendering the image onto the web page.and
which can be supporting the file types such as .gif, .jpg, .png, etc.
There are several functions available to access the HTML Image.some of its funtions
are as follows,
- document.getElementById()
- document.getElementByName()
Image Objects Properties
- id -Sets or returns the id of a Image
- border -Sets or returns the width of the Image border
- align -Sets or returns how to align an image according to the surrounding
text
- alt - Sets or returns an alternate text to be displayed, if a browser cannot
show an image
- complete - Returns whether or not the browser has finished loading the image
- height -Sets or returns the height of an image
- width -Sets or returns the width of a Image
- hspace -Sets or returns the white space on the left and right side of the
image
- isMap -Returns whether or not an image is a server-side image map
- longDesc -Sets or returns a URL to a document containing a description of
the image
- lowsrc -Sets or returns a URL to a low-resolution version of an image
- src -Sets or returns the URL of an image
- useMap -Sets or returns the value of the usemap attribute of an client-side
image map
- vspace -Sets or returns the white space on the top and bottom of the image
- title -Sets or returns an element's advisory title
- className -Sets or returns the class attribute of an element
The following code snippets explains you the HTML Image in the web form.
in .aspx.cs page,
-
void Image2_Click(object sender, EventArgs e)
{
img1.Src="orange.jpg";
img1.Height=300;
img1.Width=250;
img1.Border=7;
img1.Align="left";
img1.Alt="Image 2";
}
-
in .aspx page,
-
<form id="Form2" runat="server">
<h3>Example</h3>
<center>
<button id="btn1"
OnServerClick="img1_Click"
runat="server">
Image 1
</button>
</center>
<br><br>
<img id ="img1"
Src="apple.jpg"
Width="200"
Height="150"
Alt="Image 1"
Border="5"
Align="center"
runat=server/>
</form>
-
- Related Links
-
6cb9f4d7-a60a-431e-bd57-db2cde821eb8|0|.0