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 four basic data structures in javascript?

472


How to clone an object in javascript?

531


How do you include a comment in javascript?

465


hi iM rahul.my questions is my project is a web based & developed using java,jsp. when i record it using qtp what script i will get like either browser("jdfjkf").page("nkf").... or javawindow("f d ").javaedit("Dasf").... plz clarify my doubt asap and i also need some vbscipt of java coding?

1716


Why is javascript called richer interface?

491






How dhtml is used in javascript?

435


What are the ways to define a variable in javascript?

488


What does polyfill mean?

491


How does javascript work?

472


Explain escape() in javascript?

470


What are Cookies in Javascript?

568


Is javascript case sensitive language?

549


How to hide javascript code from old browsers that dont run it?

503


Is it possible make a call to server side event of any button using javascript?

526


What does 3 dots mean in javascript?

448