About document.getElementID? Explain giving one example.
This was asked by a interviewer when i said that i know
some JavaScript.
Answer Posted / 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 |
Post New Answer View All Answers
How do you name a variable in javascript?
How do you declare in javascript?
How to have the status line update when the mouse goes over a link (the support of the status line is sporadic)?
What is event bubbling in the dom?
What is the difference between undefined and not defined in JavaScript?
Explain closures in javascript?
What is the difference between the substr() and substring() functions in javascript?
List some design patterns in javascript?
Is javascript whitespace sensitive?
How do you add an element at the end of an array?
What can I build with javascript?
Give an example of closure?
How can the style/class of an element be changed?
How many types of functions are there in javascript?
Basic methods for opening a popup window using javascript?