Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Development-process Use Of Id attribute in Html
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Rajendra
Use Of Id attribute in Html
1 Answer(s)      5 years and 7 months ago
Posted in : Development process



Advertisement
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 Tutorials/Questions & Answers:
Use Of Id attribute in Html - Development process
Use Of Id attribute in Html    Hi, I am new to web page development.Could u plz explain what is use of id attribute in html. For example..., The id attribute specifies a unique id for an HTML element that assigns
Use of immediate attribute
Use of immediate attribute  What is the use of immediate attribute
Advertisements
Use of jQuery attribute filters
Use of jQuery attribute filters       Use of jQuery attribute filters In this section you will learn how to use attribute filters of jQuery. Using jQuery attribute filters
<html:option > with "selected" attribute - Struts
with "selected" attribute  how to display formbean object with "selected" attribute in . please help me
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
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
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
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
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
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 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
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
Target attribute in anchor tag, Use of target attribute of anchor tag in HTML5.
Target attribute in anchor tag, Use of target attribute of anchor tag in HTML5. In this tutorial, we will see the use of target attribute of anchor tag in HTML5. Target attribute tells the browser where to display linked document
id
id  how to find date of birth and gender in id in html with the help of javascript
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
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
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
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
How to use css in simple HTML application
How to use css in simple HTML application   Please give simple example for understanding purpose
i use HTML in jsp - JSP-Servlet
i use HTML in jsp  i want to make a list box of select state and corresponding to the selected state all the names of cities will be displayed in another list box.   Hi display list Selects
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
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
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
HTML5 <area> href, hreflang attribute of area tag.
HTML5 <area> href, hreflang attribute. In this tutorial we will discuss the implementation and use of  href, hreflang attributes of the <area> tag in html5. href: The href attribute specifies the URL link for the area
HTML5 type attribute, Definition of type attribute in <area> tag.
HTML5 type attribute, Definition of type attribute in <area> tag. This tutorial will inform you about <area>tag type attribute. The type attribute is used for defining the MIME (Multipurpose Internet Mail Extensions) type
Use macro to wrap HTML tags in velocity
Use macro to wrap HTML tags in velocity       This Example shows you how to use macro to wrap HTML tag in velocity  template. The method used in this example are described
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
HTML  What is a tag? How can we use MARQUEE in HTML
Language Attribute In Page Directive
Language Attribute In Page Directive  How use language attribute in page directive
jsf attribute
jsf attribute  What is the different between value and binding attribute of jsf
 

 

 

DMCA.com