jeffreywhunter
11-25-2002, 12:17 PM
I want to print the value returned by a javascript function directly in the HTML page that calls it. I have a Javascript table and lookup function (which works from a spawned page using downment.write functions).
// UserSKU, Title, Price, UnitShipCost, Taxable, SKU
// 0 1 2 3 4 5
var prodDescriptions = new Array(
new Array( "RBB101","Purple Leopard",39.95 ,0,1,101),
new Array( "RBB102","Rock Star - Purple Leopard",69.95 ,0,1,102),
new Array( "", "", 0.0, 0, 0, 0 )
);
function GetPriceFromSKU( sku )
{
for( var i=0; i<prodDescriptions.length; i++ ) {
if( prodDescriptions[i][5] == sku )
return prodDescriptions[i][2];
}
return 0.0;
}
----------------------
Now I want to print the following statement...
<BODY>
Value for item RBB102 is : GetPriceFromSKU( 101 )
</BODY>
This of course is not correct. I have tried an inline Javascript as follows, but that did not work either...
<BODY>
Value for item RBB102 is:
<script language="JavaScript">
GetPriceFromSku (01);
</script>
</BODY>
I look forward to your reply! If you see this today (11/25/02), I could use the answer right away... jeffreywhunter@wi.rr.com
Jeff...
// UserSKU, Title, Price, UnitShipCost, Taxable, SKU
// 0 1 2 3 4 5
var prodDescriptions = new Array(
new Array( "RBB101","Purple Leopard",39.95 ,0,1,101),
new Array( "RBB102","Rock Star - Purple Leopard",69.95 ,0,1,102),
new Array( "", "", 0.0, 0, 0, 0 )
);
function GetPriceFromSKU( sku )
{
for( var i=0; i<prodDescriptions.length; i++ ) {
if( prodDescriptions[i][5] == sku )
return prodDescriptions[i][2];
}
return 0.0;
}
----------------------
Now I want to print the following statement...
<BODY>
Value for item RBB102 is : GetPriceFromSKU( 101 )
</BODY>
This of course is not correct. I have tried an inline Javascript as follows, but that did not work either...
<BODY>
Value for item RBB102 is:
<script language="JavaScript">
GetPriceFromSku (01);
</script>
</BODY>
I look forward to your reply! If you see this today (11/25/02), I could use the answer right away... jeffreywhunter@wi.rr.com
Jeff...