Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


Java/Open Source Daily

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


The Image Input Type

Name:
<Form	Action="some URL">
Name:	<Input	name	= "Name">
	<Input	type	= image
		alt	= "Submit :-)"
		src	=
		"http://Stars.com/Icons/smile.gif">
</Form>
Creates a graphical submit button. The value of the src attribute specifies the URL of the image to act as the button. As with regular images, you should provide alternate text to the image to allow access in cases where the image is not displayed.

When a pointing device, e.g. mouse, is used to click on the image, the form is submitted and the (x,y) location passed to the server. The x value is measured in pixels from the left of the image, and the y value in pixels from the top of the image. The submitted data includes name.x=x-value and name.y=y-value where "name" is the value of the name attribute, and x-value and y-value are the x and y coordinate values respectively.

It's unusual for the location of the click to be important, but if it is, then you might want to consider alternative approaches to allow easier access for those not using graphical browsers:

  • Use multiple submit buttons (each with its own image) in place of a single graphical submit button.
  • Use buttons in HTML 4 (not widely supported yet by browsers).
  • Use a client-side image map together with scripting.
See also Image Input in Selena Sol's Introduction to Web Programming.


Up to => Home / Authoring / HTML / Forms