Category Archives: JAVASCRIPT

How to find the lengtth of array checkbox checked using javascript

var inputTags = document.getElementsByTagName(‘input’);
var checkboxCount = 0;
length = inputTags.length;

for (var i=0;  i<length; i++) {
if (inputTags[i].type == ‘checkbox’ &&  inputTags[i].checked) {
checkboxCount++;
}
}

if(checkboxCount<=0){
alert(‘Some messageg’);

return false;
}

How to start and stop Marquee

Here is my situation ->I need to make a Marquee stop on mouseover and start on mouseout without using java script? How can i do it? There are number of solutions. You can stop the marquee on click event, mouse over event , similarly you can start the marquee on number of javascript events.
Here are some possible ways:



  <marquee onmouseover="this.setAttribute('scrollamount', 0, 0);" onmouseout="this.setAttribute('scrollamount', 6, 0);">
      PHP Fresher     
</marquee>

Next sample on Mouseup and Mouse Down:


<marquee behavior="scroll" direction="left" onmousedown="this.stop();" onmouseup="this.start();"> PHP Fresher     </marquee>

Next Sample on MouseOver and MouseOut

<marquee behavior="scroll" direction="left" onmouseover="this.stop();" onmouseout="this.start();">PHP Fresher</marquee>

Similar Links
Example one
Example two

Javascript- Auto refresh page

This tutorial explains how to refresh the page in a certain interval. Sometime you need to refresh the page automatically while using the session. You need to load the latest content automatically . So the webpage need to be refreshed.

Sample code
<script type=”text/JavaScript”>

function autoRefresh(timeToRefresh) {
setTimeout(“location.reload(true);”,timeToRefresh);
}

</script>
<p><a href=”javascript:autoRefresh(1000)”>Refresh page in 1 sec</a></p>

Next Example:

function updateDivContent(){
    // Assuming we have #shoutbox
    $('#divtoreload').load('page.php');
}
setInterval( "updateDivContent()", 10000 );

Business services and Business news Business international onlinlen publishing Business