Jquery img src change on screen width/resize

Here is a quick example. http://jsfiddle.net/9v7ad/1/ <html> <img id=”my-img” src=””> </html> <script> $(document).ready(function(){ if($(window).width() < 640 ) { $(‘#my-img’).attr(‘src’,’http://www.24k.com.sg/images/uploads/hosting.jpg’); } if($(window).width() > 640 ) { $(‘#my-img’).attr(‘src’,’http://www.cadac.com/organice/Style%20Library/Images/organice/mainimg/mi-sol-hosted.jpg’); } }); $(window).resize(function() { if($(window).width() < 640 ) { $(‘#my-img’).attr(‘src’,’http://www.24k.com.sg/images/uploads/hosting.jpg’); } if($(window).width() > 640 ) { $(‘#my-img’).attr(‘src’,’http://www.cadac.com/organice/Style%20Library/Images/organice/mainimg/mi-sol-hosted.jpg’); } }); </script>

JavaScript img src changer based on hover and unhover

Sorry the demo doesn’t work, if the images existed it would. Use two files ../icondatalink.png and ../iconhoverdatalink.png This is a dynamic image src changer based on hover and unhover. Here is a quick example. http://jsfiddle.net/3tn2w/ <html> <img id=”my-img” src=”../icondatalink.png” onmouseover=”hover(this);” onmouseout=”unhover(this);” /> </html> <script> function hover(element) { var path = element.getAttribute(“src”); var ext = “hover”; var

JavaScript that changes Text box to blank when clicked

Here is a quick example. http://jsfiddle.net/9NTbX/ <html> <input type=”text” id=”UserName” name=”UserName” value=”UserName” onclick=”usernametoblank_clickHandler();”> </html> <script> function usernametoblank_clickHandler() { var val = document.getElementById(“UserName”).value; if (val ==  “UserName”) { document.getElementById(“UserName”).value = “”; } } </script>

JavaScript comma delimited input check boxes

Here is a quick example. http://jsfiddle.net/DXSDK/ <html> <input type=”checkbox” onclick=”checkbox_clickHandler(1);”> <input type=”checkbox” onclick=”checkbox_clickHandler(2);”> <input type=”checkbox” onclick=”checkbox_clickHandler(3);”> <input type=”checkbox” onclick=”checkbox_clickHandler(4);”> <input type=”checkbox” onclick=”checkbox_clickHandler(5);”> <input type=”checkbox” onclick=”checkbox_clickHandler(6);”> <input type=”checkbox” onclick=”checkbox_clickHandler(7);”> <input type=”checkbox” onclick=”checkbox_clickHandler(8);”> <input type=”checkbox” onclick=”checkbox_clickHandler(9);”><br> <input type=”text” id=”AccessList”> </html> <script> function checkbox_clickHandler(SiteID) { var str = document.getElementById(“AccessList”).value; var res = str.split(“,”); var x = 0 ;

Python Count every char in a text file

letters = [‘a’,’b’,’c’,’d’,’e’,’f’,’g’,’h’,’i’,’j’,’k’,’l’,’m’,’n’,’o’,’p’,’q’,’r’,’s’,’t’,’u’,’v’,’w’,’x’,’y’,’z’,’A’,’B’,’C’,’D’,’E’,’F’,’G’,’H’,’I’,’J’,’K’,’L’,’M’,’N’,’O’,’P’,’Q’,’R’,’S’,’T’,’U’,’V’,’W’,’X’,’Y’,’Z’] counter = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] i = 0 print “Started” with open(‘alice.txt’) as f: while True: c = f.read(1) if not c: print “Done” break for letter in letters: if c == letter: counter[i] = counter[i] + 1 i = 0 break i = i + 1 if i == 52: i = 0