Loading
JavaScript Interview Questions

Java Quick Notes

Refresh Your Java

We are Agile, believe in less Documentation - Only Quick notes of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

"Click on other Tabs for more Questions"  

"JavaScript "


Html/JavaScript related quick notes

1 )   Quick HTML Tags?


Ans)

Body Tag with onLoad Event :

<body onLoad="populateComboBox()"> </body>

Some other Events , onunload

HyperLink with OnClick Event :

<a href="http://test" onClick="alert('You Clicked on HyperLink')">Visit your side</a>

Some Other Events,  onmousedown,onmousemove

Tooltip -  Use "alt" attribute for ToolTip

Input Text Box :
<input type="text" name="yourname" />

Text Area :

<textarea rows="2" cols="30">
 your First Text Are
</textarea>

Button with OnClick:
<button type="button" onClick='yourSubmit();'>Click </button>
 
 Or
 
 <input type="button" value="Click">

Submit Button :
<input type="submit" value="Submit" />

Reset Button :
<input type="reset" value="Reset" />

CheckBox :
<input type="checkbox" name="vehicle" value="Bike" checked />

Combo Box :

<select id='stateList' onchange='OnChange(this)'>
  <option value="NJ">New Jersy</option>
 </select>

Bullet List

 <ul >
         <li>First Bullet</li>
         <li>First Bullet</li>
 </ul>
 
 Div :

For invisible
 <div style="display: none;">
  <h2>Click Here</h2>
</div>

For Visble

 <div style="display: block;">
  <h2>Click Here</h2>
</div>



Back to top

2 )   Form onLoad ()


Ans)

<html> 
<head> 
<script type="text/javascript"> 
function loadDropdown() 
{ 
alert("Load Your Dropdown"); 
} 

</script> 
</head>

<body onload="loadDropdown()"> 
<h1>Welcome to my Blog</h1> 
</body> 
</html>



Back to top

3 )   Form onunLoad ()


Ans)

Same as above just use "onunLoad()"



Back to top

4 )   Button Onclick


Ans)

<html> 
<head> 
<script type="text/javascript"> 
function yourSubmit() 
{ 
alert("Submit Your Form"); 
} 

</script> 
</head>

<body > 
<h1>Welcome to Button OnClick Blog</h1> 
<button type="button" onClick='yourSubmit();'>Click </button> 
</body> 
</html>



Back to top

5 )   Adding Options to HTML Dropdown


Ans)

Following Example Adds the States to States Dropdown

function addTheStates (dataArray,dataIDArray) {

//alert("addTheQuestions " + document.getElementById('questionList'));
 document.getElementById('statesList').options.length=0;
for (var i=0;i<dataArray.length;i++){
var option = document.createElement("option");
 option.setAttribute('value',dataIDArray[i]);
 option.innerHTML = dataArray[i];
 document.getElementById('statesList').appendChild(option);

 }

}



Back to top

6 )   Get selected Item from a Dropdown?


Ans)

function getSelectedValue (dropdown1) {
    var myindex  = dropdown1.selectedIndex;
    var SelValue = dropdown1.options[myindex].value;

 alert(SelValue);
}
 



Back to top

7 )   Clear HTML Text Boxes


Ans)

  function clearTextArea() {
      document.getElementById('yourTextBox').value='';
    }



Back to top

8 )   Java Script Disable right Click ?


Ans)

<script language="JavaScript1.1"> 
<!-- 
var debug = true; function 
right(e) { if (navigator.appName == 'Netscape' && (e.which == 3 || e.which 
== 2)) return false; else if (navigator.appName == 'Microsoft Internet Explorer' 
&& (event.button == 2 || event.button == 3)) { alert('This Page is fully 
protected!'); return false; } return true; } document.onmousedown=right; if (document.layers) 
window.captureEvents(Event.MOUSEDOWN); window.onmousedown=right; 
//-->

</script>



Back to top

9 )   Java ArrayList to JavaScript Array?


Ans)

function convertToArray () { 
  var nfhEvents =new Array(); 
  <% ArrayList nfhList = (ArrayList)request.getAttribute("yourList"); 
  String[] stringArray = (String[])nfhList.toArray(new String[nfhList.size()]); 
  for (int i=0;i< stringArray.length;i++) { 
  %> nfhEvents[<%= i%>] = '<%= stringArray[i] %>'; 
  <% } %> 
  
  alert(nfhEvents); 
  }



Back to top

10 )   Parse XML string by using Java Script ?


Ans)

unction xmlParser(questionName) { 
            str = "<QuestionsList><Question>What is your    name?</Question><Answer>Smith</Answer>< 
                       /QuestionsList><QuestionsList><Question>Where you born ?</Question><Answer>Herndon</Answer></QuestionsList>";

                
                        var questionArray =new Array(); 
                var xml = $.parseXML(str); 
                alert(xml.documentElement.nodeName); 
                i=0; 
                var result = $(xml).find("QuestionsList").each( 
                function(){  var question = $(this).find('Question').text(); 
                                        var name_text = $(this).find('Answer').text(); 
                                        questionArray[i] = img_path; 
                                        i++; 
                        }); 
                alert(questionArray); 
          }



Back to top

11 )   Java Script Pop up window.


Ans)

window.open('<%=request.getContextPath()%>/web/less/tests/MiniArticles.jsp?questionId='+questionId,'MiniArticles',
"menubar=1,resizable=1,scrollbars=1,width=800,height=610,");



Back to top

12 )   Java Script "Trim()" function


Ans)

Java Script "Trim()" function  

function trim(str) {
return str.replace(/^\s+|\s+$/g,"");
}



Back to top

Not Included Yet

This Portal is intended to put all Java/J2ee related topics at one single place for quick referance, not only Technical , but also the Project Management Related thing such as Development Process methodoogies build process, unit testing etc.,

This Portal has More than 500 Java Interview Questions (also could be Considered as Quick Notes) very neatly separated topic by topic with simple diagrams which makes you easily understandable. Importantly these are from our Realtime expericance.




Face Book

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free

Go To Site Map