PDA

View Full Version : Reset button



Midori
03-11-2015, 08:34 AM
Would you please help me how can i adding font reset button in bellow codes



<style>
div.font8{font-size:8px;}
div.font10{font-size:10px;}
div.font12{font-size:12px;}
div.font14{font-size:14px;}
div.font16{font-size:16px;}
div.font18{font-size:18px;}
div.font20{font-size:20px;}
</style>
<script>
var cssClassArr=new Array(7);
cssClassArr[0]="font8";
cssClassArr[1]="font10";
cssClassArr[2]="font12";
cssClassArr[3]="font14";
cssClassArr[4]="font16";
cssClassArr[5]="font18";
cssClassArr[6]="font20";
var fontSizeArr=new Array(7);
fontSizeArr[0]=8;
fontSizeArr[1]=10;
fontSizeArr[2]=12;
fontSizeArr[3]=14;
fontSizeArr[4]=16;
fontSizeArr[5]=18;
fontSizeArr[6]=20;
function increaseFontSize() {
var currentCSSClass=document.getElementById("div1").className;
var index=findIndex(cssClassArr,currentCSSClass);
var currentFontSize=fontSizeArr[index];
if(currentFontSize != 20) {
index++;
} else {
alert("Biggest size");
}
document.getElementById("div1").className = cssClassArr[index];
}
function findIndex(arr, val) {
for(var i=0; i < arr.length; i++) {
if(arr[i] == val) {
return i;
}
}
}
function decreaseFontSize() {
var currentCSSClass=document.getElementById("div1").className;
var index=findIndex(cssClassArr,currentCSSClass);
var currentFontSize=fontSizeArr[index];
if(currentFontSize != 8) {
index--;
} else {
alert("Smallest size");
}
document.getElementById("div1").className = cssClassArr[index];
}
</script>
<div id="div1" class="font10">
{$post['message']}
</div>
<img src="images/zoom_in.png" class="tooltip" title="Bigger" alt="zoomin" width="24" height="24" style="cursor:pointer;vertical-align:middle;" onClick = "increaseFontSize()" />
<img src="images/zoom_out.png" class="tooltip" title="smaller" alt="zoomout" width="24" height="24" style="cursor:pointer;vertical-align:middle;" onClick = "decreaseFontSize()" />


Thanks .:o

vwphillips
03-11-2015, 09:38 AM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<style>
div.font8{font-size:8px;}
div.font10{font-size:10px;}
div.font12{font-size:12px;}
div.font14{font-size:14px;}
div.font16{font-size:16px;}
div.font18{font-size:18px;}
div.font20{font-size:20px;}
</style>
<script>
var cssClassArr=new Array(7);
cssClassArr[0]="font8";
cssClassArr[1]="font10";
cssClassArr[2]="font12";
cssClassArr[3]="font14";
cssClassArr[4]="font16";
cssClassArr[5]="font18";
cssClassArr[6]="font20";
var fontSizeArr=new Array(7);
fontSizeArr[0]=8;
fontSizeArr[1]=10;
fontSizeArr[2]=12;
fontSizeArr[3]=14;
fontSizeArr[4]=16;
fontSizeArr[5]=18;
fontSizeArr[6]=20;
function increaseFontSize(d) {
var currentCSSClass=document.getElementById("div1").className;
var index=findIndex(cssClassArr,currentCSSClass);
var currentFontSize=fontSizeArr[index];
if (!d){
if(currentFontSize != 20) {
index++;
} else {
alert("Bibbest size");
}
}
document.getElementById("div1").className = d||cssClassArr[index];
}
function findIndex(arr, val) {
for(var i=0; i < arr.length; i++) {
if(arr[i] == val) {
return i;
}
}
}
function decreaseFontSize(d) {
var currentCSSClass=document.getElementById("div1").className;
var index=findIndex(cssClassArr,currentCSSClass);
var currentFontSize=fontSizeArr[index];
if (!d){
if(currentFontSize != 8) {
index--;
} else {
alert("Smallest size");
}
}
document.getElementById("div1").className = d||cssClassArr[index];
}
</script>
</head>

<body>
<div id="div1" class="font10">
{$post['message']}
</div>
<img src="images/zoom_in.png" class="tooltip" title="Bigger" alt="zoomin" width="24" height="24" style="cursor:pointer;vertical-align:middle;" onClick = "increaseFontSize()" />
<img src="images/zoom_out.png" class="tooltip" title="smaller" alt="zoomout" width="24" height="24" style="cursor:pointer;vertical-align:middle;" onClick = "decreaseFontSize()" />
<img src="images/zoom_out.png" class="tooltip" title="default" alt="default" width="24" height="24" style="cursor:pointer;vertical-align:middle;" onClick = "decreaseFontSize('font10')" />


</body>

</html>

sivaraman
03-11-2015, 10:00 AM
Can you please help me to do the enable the browsing history.

Already available Recently viewed products while log in. It was
deleted once log out.

I need recently viewed products after log out and log in also need
based on user log in.

Thanks in Advance!!!


Thanks


Sivaraman Arumugam

Midori
03-11-2015, 10:15 AM
Thank you very much dear vwphillips . but when click smaller button and then default button , get alert for smaller size .:confused:

vwphillips
03-11-2015, 02:53 PM
the code in post #2 has been corrected

Midori
03-11-2015, 04:52 PM
the code in post #2 has been corrected
Thanks :rolleyes: Now Its work like a charm. Thanks Again :o