Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outputting an image java script question

Status
Not open for further replies.

danxavier

Technical User
Feb 1, 2006
7
US
Hi. I found a neat little script that allows you to select one or more items from a list, then place the order which carries-over the a confirmation page where it adds up the prices, you can then confirm the order and it emails. I am trying to have it so an image can carry-over to the receiving page (confirm-order.html)

The files are:

order.htm
confirm-order.html

an example is on my website at
Below is the script code for the order.htm page

<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<p><form name=orderform action="confirm-order.html">
(Just check the items you wish to order.)<p>
<table border=1>
<tr>
<td>
<input type=checkbox name=item1A value="1A-Item_1_is_a_....*15.00$"></td>
<td>1A</td>
<td><img src="images/buildaplane1.jpg" width="120" height="21" border="0">Itemm 1 is a ....</td>
<td>$15.00</td>
</tr>
<tr>
<td>
<input type=checkbox name=item2A value="2A-Item_2_is_a_....*15.00$"></td>
<td>2A</td>
<td>Item 2 is a ....</td>
<td>$30.00</td>
</tr>
<tr>
<td>
<input type=checkbox name=item3A value="3A-Item_3_is_a_....*45.00$"></td>
<td>3A</td>
<td>Item 3 is a ....</td>
<td>$45.00</td>
</tr>
<tr>
<td colspan=4 align=center>
<input type=submit value="Order">
</td>
</tr>
</table>
</form>
&nbsp;</p>
</body>

Below is the code for the confirm-order.html page

<html>
<head>
<title> No title</title>

<meta name="GENERATOR" content="Namo WebEditor v6.0">
<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! -->

<!-- Begin
function decodeString() {
valNum = new Array();
valData = new Array();
var string, length, dataCount, orderData, grandTotal;
string = "" + unescape(location.search);
string = string.substring(1,string.length);
length = location.search.length;
orderData = "";
dataCount = 1;
for (var c = 0; c < string.length; c++)
if (string.charAt(c).indexOf("&") != -1) dataCount++;

orderData = "<table border=1 width=400>";
orderData += "<tr><td>Item</td><td>Description</td><td>Cost</td></tr>";
grandTotal = 0;
for (var i = 0; i < dataCount; i++)
{
valNum = string.substring(0,string.indexOf("="));
string = string.substring(string.indexOf("=")+1,string.length);
if (i == dataCount-1) valData = string;
else valData = string.substring(0,string.indexOf("&"));
ampd = valData.indexOf("&");
pipe = valData.indexOf("-");
star = valData.indexOf("*");
line = valData.indexOf("$");
itemnum = string.substring(0,pipe);
itemdsc = string.substring(pipe+1,star);
itemcst = string.substring(star+1,line);
string = string.substring(ampd+1,string.length);

orderData += "<tr>";
orderData += "<input type=hidden name=item" + (i+1) + "num value='" + itemnum + "'>";
orderData += "<input type=hidden name=item" + (i+1) + "dsc value='" + itemdsc + "'>";
orderData += "<input type=hidden name=item" + (i+1) + "cst value='$" + itemcst + "'>";
orderData += "<td>" + itemnum + "</td>";
orderData += "<td>" + itemdsc + "</td>";
orderData += "<td>" + itemcst + "</td>";
orderData += "</tr>";
grandTotal += parseInt(itemcst);
}
orderData += "<tr>";
orderData += "<td colspan=2 align=center>Total</td><td>" + grandTotal + ".00</td>";
orderData += "</tr>";
orderData += "<tr>";
orderData += "<td colspan=3 align=center><input type=submit value='Confirm Order!'> or <a href='javascript:history.go(-1)'>Go Back</a></td>";
orderData += "</tr>";
orderData += "<input type=hidden name=grandtotal value='$" + grandTotal + ".00'>";
orderData += "</table>";
document.write(orderData);
}

function openThanks() {
window.open("confirm-order-thanks.html"); // Can be any "thank you" page
}
// End -->
</script>

</head>
<body>
<BODY onUnload="openThanks()">
<form method=post action=" name="emailform">

<!-- Don't forget to change this to your email address! -->

<input type=hidden name=to value="aircare@altusair.com">
<input type=hidden name=subject value="** Order Form **">

<center>
<script language="JavaScript">
<!-- Begin
decodeString();
// End -->
</script>
</center>
</form>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href=" JavaScript Source</a></font>
</center><p>

<!-- Script Size: 4.79 KB -->
<p>&nbsp;</p>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top