Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Adding javascript to a dynamic template

simplytallsimplytall Posts: 1Member
I am a novice (that will become evident very soon). I have a dynamic website with a shopping cart. I need to display both original prices and sale prices on the page, but if the item is not on sale I only want the original price to show. They tell me that they only way to do this is to I enter the javascript below, into my page, but I cannot seem to get it in the right place and eliminate the unneeded portion for the information already there. The current pricing information is in red below. Any help is greatly appreciated.

Need to Add:

[color=Green]
var orig="!---ORIGINAL_PRICE---";
var price="!---PRICE---";
if (orig!=price)
document.write('Original Price: '+ orig);[/color]

My current the html for my page is:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


!---SITENAME--- - !---DESC---



function FormatCurrency (value) {
var Precision = 2;

var valStr = "" + value;
var valInt = Math.floor(value);
var valFrac = value - valInt;
var multiplier = " 1000000000000000000".substring(1,Precision+2);
var valRoundedFrac = Math.floor (valFrac*multiplier + 0.5);
valInt = Math.floor (Math.floor (value*multiplier + 0.5) / multiplier);
var valFracStr = "000000000000000000" + valRoundedFrac;
valFracStr = valFracStr.substring (valFracStr.length-Precision, valFracStr.length);

valStr = "$" + valInt + "." + valFracStr;
return valStr;
}
function FormatEuro (value) {
var Precision = 2;

var valStr = "" + value;
var valInt = Math.floor(value);
var valFrac = value - valInt;
var multiplier = " 1000000000000000000".substring(1,Precision+2);
var valRoundedFrac = Math.floor (valFrac*multiplier + 0.5);
valInt = Math.floor (Math.floor (value*multiplier + 0.5) / multiplier);
var valFracStr = "000000000000000000" + valRoundedFrac;
valFracStr = valFracStr.substring (valFracStr.length-Precision, valFracStr.length);

valStr = "" + valInt + "." + valFracStr + " EU";
return valStr;
}





<!---SITENAME---> - <!---DESC---> in <!---CURRENT_CAT_DESC--->







.style1 {
color: #000000;
font-weight: bold;
}
.style2 {
color: #FF0000;
font-weight: bold;
}




var Images = new Array();
Images[0] = "!---IMAGE---";

Images[!---INDEX---+1] = "!---IMAGE---";


function updateimage(pass){
if (pass != 0) {
document.my_form.my_image.src=Images[pass];
}
}
















!---DESC---


Enlarge Image

 

 !---CURRENT_CAT_DESC--->

 (Item no: )




















Price:

Sale Price:


Quantity:












   











Sign In or Register to comment.