About document.getElementID? Explain giving one example.

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




Answers were Sorted based on User's Feedback



About document.getElementID? Explain giving one example. This was asked by a interviewer when i..

Answer / negi

using this u can access any html elements by its id.Here we
are going to access <tr> by its id("abc").when we click on
submit button javascript execute and <tr> will not be displayed.
<html>
<head>
<title>xxx</title>
<script language="javascript" type="text/javascript">
function change()
{
document.getElementById("abc").style='none';
return true;
}
</script>
</head>
<body>
<table>
<tr id="abc">
<td>you are great</td>
<td><input type="submit" name="submit" value=""
onClick="return change();"/></td>
</tr>
</table>
</body>
</html>

Is This Answer Correct ?    17 Yes 6 No

About document.getElementID? Explain giving one example. This was asked by a interviewer when i..

Answer / 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




More JavaScript Interview Questions

Name some of the ways in which Type Conversion is possible?

0 Answers  


Is an interface is a class?

1 Answers  


How do you implement Ajax using hide() function in JQuery?

0 Answers   QuinStreet,


What’s relationship between javascript and ecmascript?

0 Answers  


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..

0 Answers  






print the following using loop. 54321 4321 321 21 1

1 Answers   Delhi Public School,


What does unshift() function do in Javascript?

0 Answers  


What are the primitive data types in JavaScript?

0 Answers  


what is java?

2 Answers  


what is syntax of wapper class

1 Answers  


What is the difference between programing language and scripting language.?

3 Answers   TCS, Reliance,


how to use java script

0 Answers   Infosys,






Categories