PDA

View Full Version : Good and Nice JavaScripts



JavaScriptBank
08-12-2010, 11:45 PM
Free JavaSccript codes

Using JavaScript to Change Your Web Page Font Size

In this short JavaScript tutorial, <i>Nurani</i> guides you how to use JavaScript in changing the web page's font size. Maybe the JavaScripts (http://www.javascriptbank.com/) to change font size are not new things on ... detail (http://www.javascriptbank.com/using-javascript-change-web-page-font-size.html/en//) at JavaScriptBank.com - 2.000+ free JavaScript codes (http://www.javascriptbank.com/)


http://www.javascriptbank.com/javascript.images/article/using-javascript-change-web-page-font-size.jpg (http://www.javascriptbank.com/javascript/article/how-to/using-javascript-change-web-page-font-size/preview/en/)
Demo: JavaScript Using JavaScript to Change Your Web Page Font Size (http://www.javascriptbank.com/using-javascript-change-web-page-font-size.html/en/)


How to setup

Step 1: Copy & Paste JavaScript code below in your HEAD section
JavaScript

<script type="text/javascript">
var min=8;
var max=18;
function zoominLetter() {
var p = document.getElementsByTagName('p');
for(i=0;i<p.length;i++) {
if(p[i].style.fontSize) {
var s = parseInt(p[i].style.fontSize.replace("px",""));
} else {
var s = 12;
}
if(s!=max) {
s += 1;
}
p[i].style.fontSize = s+"px"
}
}
function zoomoutLetter() {
var p = document.getElementsByTagName('p');
for(i=0;i<p.length;i++) {
if(p[i].style.fontSize) {
var s = parseInt(p[i].style.fontSize.replace("px",""));
} else {
var s = 12;
}
if(s!=min) {
s -= 1;
}
p[i].style.fontSize = s+"px"
}
}
</script>

Step 2: Place HTML below in your BODY section
HTML

<a href="javascript:zoominLetter();">A</a>
<a href="javascript:zoomoutLetter();">a</a>







JavaScript Line Graph script (http://www.javascriptbank.com/line-graph-script-index.html) - JavaScript Virtual Keyboard (http://www.javascriptbank.com/virtualkeyboard-index.html) - JavaScript Horizontal Slider (http://www.javascriptbank.com/horizontal-slider-javascript-v2-2.html)


The Site may provide, or third parties may provide, links to non-JavaScriptBank.com Internet World Wide Web sites or resources. Because JavaScriptBank.com has no control over such sites and resources, you acknowledge and agree that JavaScriptBank.com is not responsible for the availability of such external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. You further acknowledge and agree that JavaScriptBank.com shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods or services available on or through any such site or resource.