Forum Moderators: open

Message Too Old, No Replies

document.write

document.write question

         

steve28

11:59 pm on May 25, 2007 (gmt 0)

10+ Year Member



Hi,

I have a very simple request, but I have no direct experience of coding javascript. I have been provided with a completed piece of javascript for my page but now I want to take a couple of the variables and write them to different parts of my page using the code supplied. See below. I want to take the order ID (OID) and the transaction value (SV) and write them to different parts of my page within some html. So my question is, how do I do that?

Thanks.

Steve

<script language="javascript">
var arrParams = location.search.split("?")[1].split("&");
var SV = '';
var OID = '';
var temp = '';

if(location.search.indexOf("?")!=-1)
{
if (arrParams)
{
for (i=0;i<arrParams.length;i++)
{
var param=arrParams[i].split("=");
temp = param[0];

if(temp.toLowerCase()=="amt")
{
SV = param[1]
}
if(temp.toLowerCase()=="tx")
{
OID = param[1]
}
}
}
}

document.write ('<img src="https://www.**********.com/AdvTransaction.aspx?AdID=****&SV=' + SV + '&OID=' + OID + '" height="0" width="0" border="0">');

</script>

steve28

3:40 am on May 26, 2007 (gmt 0)

10+ Year Member



I forgot to mention that the code takes the order id and transaction amount from PayPal's data transfer service where "tx" = OID and "amt" = SV.

I am looking to write the OID and SV value to two different places on my page (within a sentence) using the values sent back to me via PayPal.

Thanks.