JavaScript Interview Questions and Answers (294) - Page 1

How to get value from a textbox?

Write following code

alert(document.getElementById('txtbox1').value);
How to get value from dropdown (select) control?

Write following code

alert(document.getElementById('dropdown1').value);
How to get value from RadioButtonList control?

Here id is the name property of the RadioButtonList

function GetRadioButtonValue(id)

{
var radio = document.getElementsByName(id);
for (var ii = 0; ii < radio.length; ii++)
{
if (radio[ii].checked)
alert(radio[ii].value);
}
}


For more details, click http://www.dotnetfunda.com/articles/article72.aspx
How to get CheckBox status whether it is checked or not?

Write following code

alert(document.getElementById('checkbox1').checked);

if it will be checked you will get true else false.
How to toggle display an HTML element?

Call following function

function ToggleFollowingText(id)

{
document.getElementById(id).style.display == '' ? document.getElementById(id).style.display = 'none' : document.getElementById(id).style.display = '';
}


In above function you need to pass id of the html element as the parameter.
If the control is already displaying then it will hide otherwise it will be shown.
What Boolean operators are not supported by JavaScript?

NOTE: This is objective type question, Please click question title for correct answer.
What does is Nan function do?

NOTE: This is objective type question, Please click question title for correct answer.
Who Developed JavaScript?

NOTE: This is objective type question, Please click question title for correct answer.
Which method is used to clear an Array in javascript?

NOTE: This is objective type question, Please click question title for correct answer.
For generating random numbers we have to used the following function?

NOTE: This is objective type question, Please click question title for correct answer.
JavaScript is interpreted by _________

NOTE: This is objective type question, Please click question title for correct answer.
Which of the following is not considered a JavaScript keyword?

NOTE: This is objective type question, Please click question title for correct answer.
What does the <noscript> tag do?

NOTE: This is objective type question, Please click question title for correct answer.
What should appear at the very end of your JavaScript? The <script LANGUAGE="JavaScript">tag

NOTE: This is objective type question, Please click question title for correct answer.
Name the DataTypes of JavaScript?

1)Integer

2)String
3)Boolean
4)Null

Which method is used to convert a string to uppercase letters?

NOTE: This is objective type question, Please click question title for correct answer.
What will be the Output of the following using JavaScript document.Write(Math.Round(6.7));

NOTE: This is objective type question, Please click question title for correct answer.
Which method is used to Clear an array using JavaSctipt?

NOTE: This is objective type question, Please click question title for correct answer.
Object can be assigned property by...

NOTE: This is objective type question, Please click question title for correct answer.
Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories