Categories
Friends
Links
Category Archives: JavaScript
How to Show/Hide a div based on day of the week with jQuery
JavaScritpt <script type="text/javascript"> $(document).ready(function() { today=new Date() thisDay=today.getDay() $("#sunday").hide(); $("#monday").hide(); $("#tuesday").hide(); [...]
Also posted in jQuery Tagged date, day of week, getDay, hide, JavaScript, jQuery, show Leave a comment
How to Create a Drop Down Select with Links without a form submit.
HTML <form action="../"> <select onchange="window.open(this.options[this.selectedIndex].value,’_top’)"> <option value="contact.html">Contact Page</option> <option value="http://www.apple.com">Apple</option> <option value="http://www.yahoo.com">Yahoo</option> <option value="http://www.google.com">google</option> <option value="about.html">About Us</option> </select> </form> Demo Contact Page Apple Yahoo google About Us
Also posted in HTML Tagged Drop Down, form, How to, HTML, JavaScript, Links, Select, submit Leave a comment
How to Submit Form on Selection of Dropdown Item
HTML <select class="dropdown" id="form2" name="form2" onchange="this.form.submit();"> <option value="*">– All –</option> <option selected="selected" value="NSW">NSW</option> <option value="WA">WA</option> <option value="QLD">QLD</option> <option value="VIC">VIC</option> <option value="ACT">ACT</option> <option value="NT">NT</option> <option value="NZ">NZ</option> </select>
How to Detect iPhone with JavaScript
Use Javascript to detect then apply different style for iPhone. JavaScript if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { if (document.cookie.indexOf("iphone_redirect=false") == -1) { window.location = "http://yoursite.com/iphone"; } }
How to Disable or Block Right Click – JavaScript
JavaScript <script language=JavaScript> function clickIE() { if (document.all) { return false; } } function clickNS(e) { if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) { return false; } } } if (document.layers) { document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS; } else{ document.onmouseup=clickNS; document.oncontextmenu=clickIE; } document.oncontextmenu=new Function("return false") </script>
How to Limit the Number of Characters in a Form Field – JavaScript
JavaScript <script language="javascript" type="text/javascript"> function limitText(limitField, limitCount, limitNum) { if (limitField.value.length > limitNum) { limitField.value = limitField.value.substring(0, limitNum); } else [...]
How to Create a Simple Rotator Ad/Banner with JavaScript
JavaScript <script language=JavaScript> var img_width = "468"; var img_height = "60"; var img_title = "Click Here"; var ad=new Array() //insert here your images src ad[0]=‘images/Banner01.jpg’; ad[1]=‘images/Banner01.jpg’; ad[2]=‘images/Banner01.jpg’; ad[3]=‘images/Banner01.jpg’; var links=new Array() //insert here your links links[0]=‘http://www.link01.com’; links[1]=‘http://www.ink02.com’; links[2]=‘http://www.ink03.com’; links[3]=‘http://www.ink04.com’; var xy=Math.floor(Math.random()*ad.length); document.write(‘<a href="’+links[xy]+‘" target="_blank"><img src="’+ad[xy]+‘" width="’+img_width+‘" height="’+img_height+‘" alt="’+img_title+‘" border="0"></a>’); </script> [...]
How to Convert Decimal to Binary – JavaScript
JavaScript <SCRIPT language="JavaScript"> function check() { dec = document.DecToBin.deci.value; if (dec == "") {alert("please insert decimal number first."); } else {scan(dec);}; }; function scan(ok) { var chr="1234567890"; count=0; [...]
How to Create a Countdown Timer that Refreshes the Page Daily