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
What is the difference between push() and concat() in javascript?
How to create an object in javascript?
What are the different ways to create an array in javascript?
How do you write an event emitter base class that allows you to add event listeners?
How to get the contents of an input box using javascript?
What is an anonymous function in JavaScript?
What does 3 dots mean in javascript?
discuss scoping in javascript?
How do you round a value in javascript?
What is the difference between sessionstate and viewstate?
How to have the status line update when the mouse goes over a link (the support of the status line is sporadic)?
wap to accept an int array frm the user and print the lucky nos.
How do I enable cookies and javascript?
What Is The Disadvantages Using InnerHTML In JavaScript?
Is javascript a security risk?