Author: Gugu Ncube
-
JavaScript – Check if HTML Links is visited or not
UPDATE: Code no longer works accross all browser. The reason is pretty clear – History Theft ! function hasLinkBeenVisited(url) { var link = document.createElement(‘a’); link.href = url; document.body.appendChild(link); if (link.currentStyle) { //IE var color = link.currentStyle.color; //alert(“[IE] url:”+url+”, color:”+color) if (color == ‘#800080’){ return true; } } else { // Firefox link.setAttribute(“href”,url); var computed_style =…
-
Python – Check List of URLs
# -*- coding: UTF-8 -*- def main(): source=’/webdev/links-of-urls.txt’; destination=source+”.result” check_urls(source, destination) print(‘done!’) def check_urls(source, destination): with open(source, ‘w’) as fout: with open(source, ‘r’) as fin: for url in fin: pre=”ERR” try: data = urllib2.urlopen(url.trim()).read() pre=”OK” except: print(“Failed…”) fout.write(pre+” “+url) if __name__ == ‘__main__’: main()
-
CSS – Styling HTML Links – removing underline
Simple Link styling Link: This Link to Google is Red Code: Link: This Link to Google is Red Link styling for visited links Link: This Link to my Blog is always Green Code: In order to make sure that the link color “sticks” even for visited links, use the following CSS. Link: This Link to…
-
JavaScript – Check and uncheck Checkboxes
Choose Your Favorite Programming Languages Java Python PHP HTML JavaScript SQL | Code: Your Favorite Scripts & Languages Java Python PHP HTML JavaScript SQL |
-
JavaScript – Dynamically Change Title of Current Browser Page
Click Here To Change Page Title JavaScript Property: document.title Code: Click Here To Change Page Title