Use Of Id attribute in Html 1 Answer(s) 4 years ago
Posted in : Development process
View Answers
May 26, 2009 at 12:22 PM
Hi Friend,
The id attribute specifies a unique id for an HTML element that assigns a identifier value to a tag. Each element can only have one id.
It can be used by a JavaScript or by CSS to make changes or style the element with the specified id.
Now we are providing you the code that will display textbox value and selected combobox value using id attribute:
1) TextBox
<html> <head> <script type="text/javascript"> function hello(){ var message=document.getElementById("tex"); alert("You have entered the message "+message.value); } </script> </head> <body> <input id="tex" type="text"> <input type="button" onclick="hello();" value="Click"> </body> </html>
2)ComboBox
<html> <head> <script type="text/javascript"> function hello(){ var combo = document.getElementById("com"); var comboValue = combo.options[combo.selectedIndex].text alert("You have selected: "+comboValue); } </script> </head> <body> <select id="com" name="combo"> <option value="0">-Select-</option> <option value="1">India</option> <option value="2">USA</option> </select> <input type="button" onclick="hello();" value="Click"> </body> </html>
Thanks
Related Pages:
Use Of Id attribute in Html - Development process Use Of Idattribute in Html
Hi,
I am new to web page development.Could u plz explain what is use of idattribute in html. For example...,
The idattribute specifies a unique id for an HTML element that assigns
id
id how to find date of birth and gender in id in html with the help of javascript
HTML5 target attribute, Definition and use of target attribute.
HTML5 target attribute, Definition and use of target attribute.
In this tutorial we will inform about the target attribute of <area> tag
in html5. This attribute is used for specifying the name of the window or
frame where
Use of jQuery attribute filters Use of jQuery attribute filters
Use of jQuery attribute filters
In this section you will learn how to useattribute filters of jQuery.
Using jQuery attribute filters
HTML5 audio loop, Use of loop attribute of audio tag in HTML5.
HTML5 audio loop, Use of loop attribute of audio tag in
HTML5.
Introduction:Loop attribute is used for
reputation of audio or music. It repeats... will be repeated
automatically.
loop attribute:
Attribute
Value
HTML5 audio autobuffer, Use of autobuffer attribute in audio tag.
HTML5 audio autobuffer, Use of autobuffer attribute in
audio tag.
Introduction:The autobuffer attribute has
Boolean value. It is available in audio tag. Autobuffer
attribute is used for buffering a file in advance. It continues
HTML5 audio autoplay, Use of autoplay attribute in audio tag.
HTML5 audio autoplay, Use of autoplay attribute in
audio tag.
Introduction:The autoplay is an
audio tag attribute. It is only supported by HTML5.
When... web page, music will start automatically .
autoplay attribute:
Attribute
contentType attribute in the page directive
contentType attribute in the page directive How use contentType attribute in the page directive ?
contentType attribute is used to set the mime type and character set of the JSP. The user can make use of any MIME
HTML
;
Horizontal Rule Attribute in HTML
Checkbox is used... attribute.
Vertical Frameset in HTML... Radio Button
HTML Post attribute used in method, when a user is not able
retrieve multiple attribute values
retrieve multiple attribute values Hello All
Am a beginner. Would...:Output rdf:ID="_DIAGNOSTICPROCESS">
<process:parameterType rdf:datatype="http...:Output rdf:ID="_LENGTHMEASURE">
<process:parameterType rdf:datatype="http
retrieve multiple attribute values
retrieve multiple attribute values Hello All
Am a beginner. Would...:Output rdf:ID="_DIAGNOSTICPROCESS">
<process:parameterType rdf:datatype="http...:Output rdf:ID="_LENGTHMEASURE">
<process:parameterType rdf:datatype="http
retrieve multiple attribute values
XML retrieve multiple attribute values Hello All
Am a beginner...;process:Output rdf:ID="_DIAGNOSTICPROCESS">
<process:parameterType rdf...;
<process:Output rdf:ID="_LENGTHMEASURE">
<process:parameterType rdf
how to use ajax in html file
how to use ajax in html file <!DOCTYPE html PUBLIC "-//W3C//DTD...;
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<..." />
<meta http-equiv="Content-Type" content="text/html; charset
JDOM Attribute Example, Different method of Attribute class.
JDOM Attribute Example, Different method of Attribute class.
This tutorial explains the use of the getParent()
and getQualifiedName(). These methods are present in the
Attribute class. The
Attribute class is available
PHP HTML Form Method Attribute
Topic : PHP HTML Form Method Attribute
Part - 3
The second attribute in the form tag is Method. With the help of Method
attribute, we can tell the browser... get visible
to the user in the URL. In our Html Form tutorial we will use both
Page Directive attribute - contentType
contentType="text/xml" %>
For HTML page, we will use following page... will use following page
directives -
<%@ page contentType="text/html...Page Directive attribute - contentType
This section contains description
Button disabled in HTML5, Example of autofoucs and disabled attribute.
the use of disabled and
autofocus attribute of button tag. If disabled attribute...
attribute is available in button tag. It specifies that controls will be focus
automatically, when page load.
Attributes of type tag:
Attribute
HTML Action attribute - Java Beginners HTML Action attribute I have folder structure like this
WebApplication1
-web
-emp_event.jsp
-src
-java...
In action Attribute I want to give emp_event.java class.
But When I run I am
Use of @ for attribute in XPath Use of @ for attribute in XPath
 ... are
describing you the use of @ for attribute in the XPath query. The
"@" selects... want to show all elements with attributeid="3" of the person so we
Anchor tag attributes in HTML5, Define the type attribute of anchor tag.
In this tutorial, we will see the use of type attribute of anchor tag . The
type attribute of anchor tag specifies the MIME (multipurpose internet... mail.Example text/plain, text/html, text/xml etc.
Declaration Syntax :
Declaration
HTML Elements
Name
Attribute Value
Description
IDID Name
ID... will learn about some more of them. Use of images in HTML for web site development... important attributes of an image used in HTML---
Attribute Name
HTML Button onclick get ID of Button HTML Button onclick get ID of Button How i can get the ID of HTML Button on click?? I wanted to do it using JavaScript function.
Thanks
The "contentType" Attribute of Page Directive
The "contentType" Attribute of Page Directive
In this Section, we will discuss about the "contentType" attribute of page
directive with an example. The "contentType" attribute is used for setting the
'
Horizontal Rule Attribute in HTML
Horizontal Rule Attribute in HTML
 ... Horizontal Rule Attribute in HTML.
In this Tutorial, the code apply a horizontal... of size 6 in html page.
The common attribute used in horizontal rule
HTML
HTML What is a tag? How can we use MARQUEE in HTML
id generation id generation CREATE TABLE `mohan2` (
`sno` bigint(20) NOT NULL...+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN...;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<
MySQL Attribute
MySQL Attribute
This example illustrates how to use the COLLATE attribute in MySQL.
In this example we use the COLLATE attribute to define the attribute... and collation for the column.
Query
CREATE TABLE atttribute (attribute_name CHAR
Use of Selectors
are discussing the use of jQuery selectors.
For using JQuery library most effectively... impossible to implement
functionalities on elements of html.
Following... the elements E that have an id value of i. Omitting E is
identical to *#i
Tomahawk outputLabel tag
the id for that component is
set. This is same as html label tag... the id for the component just the same as we have mentioned in the idattribute....
But this component has an attribute forceId which forces the component to render
the same id
JDOM Attribute Example, How to create clone of attribute in java.
JDOM Attribute Example, How to create clone of attribute in java.
In this tutorial, we will see how to create a clone of
attribute in java by using JDOM... documents, it is a tree based Java api
In this example, we use few
HTML
HTML How do we use an image instead of the standard submit button
Java Servlet : Get Attribute
Java Servlet : Get Attribute
In this tutorial, we will discuss how... of the
named attribute in form of object. If no attribute found of specified name... the the name of the attribute
Returns: an object that containing value
Rel attribute in area tag, Use of rel attribute in area tag.
Rel attribute in area tag, Use of rel attribute in area tag.
In this tutorial, you will see the use of rel attribute of area tag and how
to implement. The rel (relationship) attribute defines the relationship between
current page
HTML5 input attribute, Define the type, alt and image of input tag.
HTML5 input attribute, Define the type, alt and image of input tag.
Introduction:Here we will introduce you to about the type
attribute of input tag... image is not displayed.
Type Attribute:
Attribute
Value
Hreflang Attribute, Use of hreflang attribute of anchor tag in HTML5.
Hreflang Attribute, Use of hreflang attribute of anchor tag in HTML5.
In this tutorial, we will see the use of hreflang attribute
and how to implement. Hreflang gives the language of linked
document. This attribute can be used when
Introduction to HTML
. These are referred to as attributes. An attribute has a specific value.
HTML Headings... an image in HTML, we use the <img> tag. The path of the location of the image...
Introduction to HTML
 
HTML Books HTML Books
HTML
Quick Reference Guide Books... HTML 2.0, RFC 1866) and may not yet be supported by all browsers: elements marked
Rel attribute in anchor tag, Use of rel attribute in anchor tag.
Rel attribute in anchor tag, Use of rel attribute in anchor tag.
Description:You will see the use of rel attribute of anchor tag and how
to implement. The rel (relationship) attribute defines the relationship between
current page
Button Size HTML HTML Button Size can be changed according to programmer use. HTML button
submits HTML page.
In the following example we will learn how to change the size... attribute
bgcolor and putting any color value into it in HTML Page.
Cascading Style
The isErrorPage Attribute of page Directive In JSP
you
cannot use the exception object because the default value of the attribute... The isErrorPage Attribute of page Directive In JSP... illustration of the isErrorPage
attribute of the page directive in JSP by providing
JavaScript createAttribute method
;
In the HTML JavaScript we have one of the important
method createAttribute which can be used to create the html tag's attribute
dynamically. We can create any attribute of the tag
elements by getting the object
Set Background Colors and Images in HTML
;
<head><title>Example on the use of Background Colors in HTML
<... to a background image. For this we use the body
attribute background and write... Set Background Colors and Images in HTML