About document.getElementID? Explain giving one example.

This was asked by a interviewer when i said that i know
some JavaScript.

Answer Posted / kishore.gsgs

using this u can access any html elements by its id.Here we
are going to access <input> textbox by its id("abc").when we
click on
submit button javascript execute and <tr> will not be displayed
<html>
<head>
<script type="text/javascript">

function change()
{
alert("success");
alert(document.getElementById("kishore").value);
}
</script>

</head>
<body>
<input type="text" id="kishore">
<input type="button" name="submit" value="submit"
onClick="change()"/>
</body>
</html>

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Name the types of functions.

589


How do we get javascript onto a web page?

562


How to get value from a textbox?

693


How dhtml is used in javascript?

519


How do I run javascript on my iphone?

568






What is argument objects in javascript?

572


How to calculate fibonacci numbers in javascript?

594


How to create an object in javascript?

719


What are Cookies in Javascript?

655


What is purpose of onerror event handler in javascript?

560


What are the methods involved in javascript?

591


How can you create an Array in JavaScript?

656


what is the difference between let, var, and const?

644


What is array constructor in javascript?

581


Public Static Void Main(String args[]) { System.out.in("Hai.."); } In the above code why string args[] is required.... If we are not giving command line argument..

1683