Append a query string to the link from the item page to the order page, such
as
<a href="orderpage.htm?itemid=1234">Order</a>
Add this script to the <head> section of the order page.
<script>
function qsobj (){
var qvbl;
var qstring = "" + document.location.search.substring(1);
if (qstring != ""){
var qpairs = qstring.split("&");
for (i=0; i < qpairs.length; i++) {
qvbl = qpairs
.split("=");
this["" + qvbl[0]] = unescape(qvbl[1].replace("+"," "));
}
}
}
function getqsvar(qsvar){
if (qstr[qsvar] == null){
return "";
}else{
return qstr[qsvar];
}
}
var qstr = new qsobj();
</script>
Name the Item Number text box ItemNumber.
Add the following onload= attribute to your <body> tag:
<body onload="document.forms[0].ItemNumber.Value = getqsvar("itemid") ;">
However, this is going to get very ugly (and difficult) if you want to build
a shopping card with multipel items, computer order totals and shipping,
collect charge card numbers, and so forth. If you have these features in
mind, you might as well start looking for a commerical shopping cart
application now. Chances are, your host already has one or more of these
available for a reasonable fee.
Jim Buyens
Microsoft MVP
http://www.interlacken.com
Author of:
*-----------------------------Â-----------------------
|\----------------------------Â-----------------------
|| Microsoft Windows SharePoint Services Inside Out
|| Microsoft Office FrontPage 2003 Inside Out
||----------------------------Â-----------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/----------------------------Â-----------------------
*-----------------------------Â-----------------------
Andrea said:
I am creating a webpage for a small business and I am making order forms.
Next to each item I have a button and it takes you to our order form page. I
want our customers to be able to click on that button and have the item
number automatically entered into the "Item Number" field on the order form.
Any ideas?
Thanks!