Home  Interview Questions  Certifications  Aptitude Questions  Tutorials  Placement Papers  Search  Resume  Soft Skills  Video  Forum  Blog

Android app on Google Play

Technical Interview Questions
Oracle Interview Questions
J2EE Interview Questions
C++ Interview Questions
XML Interview Questions
EJB Interview Questions
JSP Interview Questions

Programming Source Codes
Java Source Codes
Html Source Codes
CSS Source Codes
C Source Codes

Soft Skills
Communication Skills
Leadership Skills




Javascript Interview Questions and Answers

How to Accessing Elements using javascript?
To do something interesting with HTML elements, we must first be able to uniquely identify which element we want. In the example
<form action="">
<input type="button" id="useless" name="mybutton" value="doNothing" />

We can use the "getElementById" method (which is generally preferred)
document.getElementById("useless").style.color = "red";
or we can use the older hierarchical navigation method,
document.forms[0] = "blue";
Notice that this uses the "name" attribute of the element to locate it.
# Example of Accessing Elements in a DOM.

<script type="text/javascript" >
function showStatus() {
var selectWidget = document.forms.beerForm.elements["beer"];
var myValue = selectWidget.options[selectWidget.selectedIndex].value;
alert('You drank a \"'+ myValue +"\"");
return true;

<form name="beerForm" action="">
<select name="beer">
<option selected="selected">Select Beer</option>
<option>Amstel Light</option>
<option>Corona Light</option>

<input type="button" name="submitbutton" value="Drink"
onclick="showStatus()" />

What looping structures are there in JavaScript?
for, while, do-while loops, but no foreach.

To put a "close window" link on a page ?
<a href='javascript:window.close()' class='mainnav'> Close </a>

How to hide javascript code from old browsers that dont run it?
Use the below specified style of comments <script language=javascript> <!-- javascript code goes here // --> or Use the <NOSCRIPT>some html code </NOSCRIPT> tags and code the display html statements between these and this will appear on the page if the browser does not support javascript

How to comment javascript code?
Use // for line comments and

*/ for block comments

Name the numeric constants representing max,min values

What does javascript null mean?
The null value is a unique value representing no value or no object.
It implies no object,or null string,no valid boolean value,no number and no array object.

How do you create a new object in JavaScript?
var obj = new Object(); or var obj = {};

How do you assign object properties?
obj["age"] = 17 or obj.age = 17.

What’s a way to append a value to an array?
arr[arr.length] = value;

What is this keyword?
It refers to the current object.

Page Numbers :   1       2       3       4       5       6       7        8        9       10        11       12       13

Have a Question ? post your questions here. It will be answered as soon as possible.

Check Java Interview Questions for more Java Interview Questions with answers

Check Structs Interview Questions for more Structs Interview Questions with answers

Check Servlet Interview Questions for more Servlet Interview Questions with answers