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

What are the primitive data types in JavaScript?

551


Difference json arrary vs json object ?

557


How to create a confirmation box?

553


What is the role of a strict mode in javascript?

528


What is createtextnode?

484






What e means?

516


What is the default scope in javascript?

434


What is a scope in javascript?

464


Explain how can you submit a form using JavaScript?

494


What is the use of Void(0)?

611


Is javascript harmful?

484


Is javascript multi-threaded or single-threaded?

497


How can you read properties of an Object in JavaScript?

537


What are screen objects?

526


Who introduced javascript?

500