ladybugz46
09-12-2002, 05:00 PM
I am trying to create a print friendly order form for our site. The variables are set up for a system called web order - What I want it to do is pass the variables only to a popup with the static code for the order form in it. Then the order form will print without its headers and side bar navigation and still contain all the pertinent information.
I am using the below script:
First Page:
<html>
<head>
<title>Untitled</title>
<script language="JavaScript">
<!--
function getOrder() {
var order = new Array("!+ORNO!","!+TMF1!","!+TML1!","!+SHSM!");
document.input.data.value = order.join('_');
}
//--></script>
</head>
<body>
<form name="input" onSubmit="getOrder()" action="test_second_page.htm">
<input type="hidden" name="data">
<input type="submit">
</form>
</body>
</html>
-----------------------------------------------------------
Second Page (popup)
<html>
<head>
<title>Untitled</title>
<script language="JavaScript">
<!--
var orderValue = (location.search.substring(1)).split('=');
if (orderValue.length == 2) {
var order = unescape(orderValue[1]).split(',');
document.output.data.value = orderValue.join('\r\n');
}
//--></script>
</head>
<body>
<form name="output">
<textarea name="data" cols="2" rows="10"></textarea>
</form>
</body>
</html>
---------------------------------------------------
I have the following questions:
(and yes...I am really new to javascript and really really trying to learn here)
0. The above script is my test script, in the working environment, it passes the varialbles to the location bar fine....where I really don't understand is how to get it back in the page in the pop up.
1. This script errors in the second page and for the life of me I can't see why.
2. Shouldn't it print the value of the array into the text area? It does not and I don't see why. I can send the entire page and a link to the site so that you can see the entire page if that will help.
3. Ultimately I need to restore the variables in the pop up with the html from the original page. Is this a good way to approach this problem or is there a better way.
4. My supervisor would prefer that I do this in vbscript....I am new to vbscript....does anyone know of any tutorials that might help.
Thanks in advance: sue
I am using the below script:
First Page:
<html>
<head>
<title>Untitled</title>
<script language="JavaScript">
<!--
function getOrder() {
var order = new Array("!+ORNO!","!+TMF1!","!+TML1!","!+SHSM!");
document.input.data.value = order.join('_');
}
//--></script>
</head>
<body>
<form name="input" onSubmit="getOrder()" action="test_second_page.htm">
<input type="hidden" name="data">
<input type="submit">
</form>
</body>
</html>
-----------------------------------------------------------
Second Page (popup)
<html>
<head>
<title>Untitled</title>
<script language="JavaScript">
<!--
var orderValue = (location.search.substring(1)).split('=');
if (orderValue.length == 2) {
var order = unescape(orderValue[1]).split(',');
document.output.data.value = orderValue.join('\r\n');
}
//--></script>
</head>
<body>
<form name="output">
<textarea name="data" cols="2" rows="10"></textarea>
</form>
</body>
</html>
---------------------------------------------------
I have the following questions:
(and yes...I am really new to javascript and really really trying to learn here)
0. The above script is my test script, in the working environment, it passes the varialbles to the location bar fine....where I really don't understand is how to get it back in the page in the pop up.
1. This script errors in the second page and for the life of me I can't see why.
2. Shouldn't it print the value of the array into the text area? It does not and I don't see why. I can send the entire page and a link to the site so that you can see the entire page if that will help.
3. Ultimately I need to restore the variables in the pop up with the html from the original page. Is this a good way to approach this problem or is there a better way.
4. My supervisor would prefer that I do this in vbscript....I am new to vbscript....does anyone know of any tutorials that might help.
Thanks in advance: sue