Posted by: Amit Nazare on: August 6, 2009
You people might be wondering how you could change the contents of an HTML element? like to replace the innerhtml with the one selected from the select box. Its very easy, you’ll be able to change your text and HTML as much as you like with the help of JavaScript innerHTML. Many HTML elements rather [...]
Posted by: Amit Nazare on: August 6, 2009
DOM stands for Document Object Model is a W3C (World Wide Web Consortium) standard. The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document. DOM has three different levels: 1. Core DOM – standard model [...]
Posted by: Amit Nazare on: July 16, 2009
Here is another tutorial for JavaScript. How to show/hide your div block with check box. Its very easy and simple to understand. Just copy the below code and try. JavaScript : <script type=”text/javascript”> function showMe (ids, box) { var vis = (box.checked) ? “block” : “none”; document.getElementById(ids).style.display = vis; } </script> Here the above JavaScript [...]
Posted by: Amit Nazare on: May 6, 2009
Here is a code to toggle and display the bock element using simple JavaScript and CSS. Try the below code Put this code in your body section <a href=”toggle(‘myDiv’)”>Toggle</a><br /> <div id=”myDiv” style=”display:none;”> <p>Some Text goes here … Blah Blah Blah….</p> </div> Put this in the head section of your page <script language=”javascript”> <!– function [...]
Posted by: Amit Nazare on: April 28, 2009
Here is an example how we can change the image on mouse over. <a href=”#” onmouseover=”document.btn1.src=’images/img1.jpg’” onmouseout=”document.btn1.src=’images/img2.jpg’”><img src=”images/img2.jpg” alt=”” border=”0″ name=”btn1″/></a> Here in this example I have used onmouseover one image and onmouseout another image. You can see the name parameter for the img tag. Using this tag I am changing the image that is [...]
Posted by: Amit Nazare on: April 1, 2009
To display a visitor’s screen resolution, simple include the following javascript code in your page: <script type=”text/javascript”> document.write(‘Screen Resolution: ‘ + screen.width + ‘ * ‘ + screen.height); </script>
Posted by: Amit Nazare on: December 29, 2008
To open a new window by clicking on the link, you will need to use window.open method of javascript. Example: <a href=”javascript: void(0)” onclick=”window.open(‘http://nazare.50webs.com’, ‘windowname’, ‘width=200, height=77′); return false;”>Click here for simple popup window</a> Now you can open a simple window, also this function can have different features of that window to appear. Feature List: [...]