you know what, you're right, that will only work on an onload...
okay, here it is, all my code...
<Script Language=JavaScript>
////////////////////////////////
// remove terms and add form //
//////////////////////////////
function authorize()
{
var elem = document.getElementById("second");
elem.style.display = "block";
document.getElementById('accTerms').style.display = 'none';
}
//////////////////////////////////////////////
// create last/first name drop down fields //
////////////////////////////////////////////
function insertRows(isTable){
index = isTable.rows.length;
nextRow = isTable.insertRow(index);
isText1 = nextRow.insertCell(0);
isText2 = nextRow.insertCell(1);
index++;
index = index.toString();
nameStr1 = "Lname"+index;
nameStr2 = "Fname"+index;
txtStr1 = "Last Name "+index+":<br><input name="+nameStr1+" type='text' size='18' maxlength='18'>";
txtStr2 = "First Name "+index+":<br><input name="+nameStr2+" type='text' size='18' maxlength='22'>";
isText1.innerHTML = txtStr1;
isText2.innerHTML = txtStr2;
isText1.width ='25%'
isText2.width = '75%'
}
function adjustRows(isVal,isTable){
currRows = isTable.rows.length;
newRows = isVal;
if (currRows > 0){for (i=0; i<currRows-0; i++){isTable.deleteRow()}}
for (i=0; i<newRows; i++){insertRows(isTable)}
}
/////////////////////////////
// open approval section //
//////////////////////////
function openApprov()
{
var elem = document.getElementById("approvSection");
elem.style.display = "block";
document.getElementById('continue').style.display = 'none';
}
////////////////////////////
// create approval code //
//////////////////////////
var valid = new Array("2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
function getRandom()
{
var num = Math.floor(Math.random() * valid.length);
return valid[num];
}
function randomString()
{
return "4" + getRandom() + getRandom() + getRandom();
}
//////////////////////////////////////////////
// create last/first name drop down fields //
////////////////////////////////////////////
function insertTN(isTable){
index = isTable.rows.length;
nextRow = isTable.insertRow(index);
isText1 = nextRow.insertCell(0);
index++;
index = index.toString();
nameStr1 = "TN1"+index;
txtStr1 = "Passenger "+index+":<br><input name="+nameStr1+" type='text' size='18' maxlength='18'>";
isText1.innerHTML = txtStr1;
isText1.width ='25%'
}
function adjustTN(isVal,isTable){
currRows = isTable.rows.length;
newRows = isVal;
if (currRows > 0){for (i=0; i<currRows-0; i++){isTable.deleteRow()}}
for (i=0; i<newRows; i++){insertTN(isTable)}
}
/////////////////////////////////
// open confirmation section //
//////////////////////////////
function reviewConfirm()
{
var elem = document.getElementById("reviewConfirm");
elem.style.display = "block";
document.getElementById('second').style.display = 'none';
}
//////////////////////////
// confirmation section//
////////////////////////
function doConfirm()
{
document.getElementById("confirmation1").innerHTML=document.getElementById("agency").value;
}
</Script>
<body onload="document.forms['request'].elements['appCode'].value = randomString();">
<span class="cpyBody"><br>
<div id="accTerms">
<table width="608" border="0" cellspacing="0" cellpadding="2" class="cpySmall">
<tr>
<td height="25" valign="top" class="cpyHeader1"><a name="terms" id="terms"></a>Acceptance
of Terms</td>
</tr>
<tr valign="top">
<td height="45" class="cpyBody">By selecting <span class="cpyBold">Agree</span>,
I certify I have read and agree to the terms and conditions<br>
<br>
<span class="cpyHeader2">Terms & Conditions</span> <br>
These are the terms and conditions, blah blah blah. </td>
</tr>
<tr valign="top">
<td height="23" class="cpySmall"> <a href="#terms"><img src="/images/buttons/agree.gif" type="image" alt="Agree" width="61" height="17" border="0" align="right" onClick="authorize()"></a></td>
</tr>
</table>
</div>
<form name="request">
<div id="second" style="display: none;">Complete the following form to create an approval
code for your PNR. This form must be completed in full for each PNR where an exception
is being made. Once you select agree, an approval code will be generated for your
PNR. After you issue your tickets, you will need to provide the ticket numbers to
validate the approval code.<br>
<br>
<table width="608" border="0" cellpadding="5" cellspacing="1" class="tblBorder">
<tr>
<td class="tblWhite">
<table width="608" border="0" cellpadding="0" cellspacing="1">
<tr>
<td valign="top"><table width="550" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><span class="cpyBody">*Required</span></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<table width="550" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="25" colspan="3" valign="top" class="cpyHeader1"> Agency
Information</td>
</tr>
<tr>
<td width="32%" class="cpySmall">*Agency name:<br>
<input name="agency" type="text" id="agency" tabindex="1" value="" size="25">
</td>
<td width="20%" class="cpySmall">*ARC number:<br>
<input name="arc" type="text" id="arc" tabindex="2" value="" size="8" maxlength="8">
</td>
<td width="48%" class="cpySmall">E-mail address:<br>
<input name="email-required" type="text" id="email-required" tabindex="3" value="" size="20" maxlength="22">
</td>
</tr>
</table>
<br>
<table width="550" border="0" cellspacing="0" cellpadding="2">
<tr>
<td height="25" colspan="3" valign="top" class="cpyHeader1">Itinerary
Details</td>
</tr>
<tr valign="top">
<td width="70" height="45" class="cpySmall">*Date booked:<br>
<input name="datebooked" type="text" id="datebooked" tabindex="4" value="" size="8" maxlength="8">
</td>
<td width="123" height="45" class="cpySmall">*Record locator:<br>
<input name="recordlocator" type="text" id="recordlocator" tabindex="5" value="" size="18" maxlength="22">
</td>
<td width="345" height="45" class="cpySmall">*Number of passengers: <br>
<select name="numpassengers" tabindex="6" id="numpassengers" onchange="adjustRows(this.value,nameSet);adjustTN(this.value,ticketSet);">
<option value="1" selected>Select one
<option value="1">1
<option value="2">2
<option value="3">3
<option value="4">4
<option value="5">5
<option value="6">6
<option value="7">7
<option value="8">8
<option value="9">9
</select>
</td>
</tr>
</table>
<table width="550" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="14%" height="45" class="cpySmall">*Flight number:<br>
<input name="flightnum" type="text" id="flightnum" tabindex="7" value="" size="5" maxlength="4">
</td>
<td width="18%" height="45"class="cpySmall">*Departure date:<br>
<input name="deptdate" type="text" id="deptdate" tabindex="8" value="" size="8" maxlength="8">
</td>
<td width="24%" height="45" class="cpySmall">*Departure city:<br>
<input name="deptcity" type="text" id="deptcity" tabindex="9" value="" size="12" maxlength="22">
</td>
<td width="44%" height="45" class="cpySmall">*Fare basis:<br>
<input name="farebasis" type="text" id="farebasis" tabindex="10" value="" size="18" maxlength="22">
</td>
</tr>
</table>
<table width="550" border="0" cellpadding="2" cellspacing="0" id="nameSet" class="cpySmall">
<tr>
<td width="25%" height="18" valign="top" class="cpySmall">*Last name
1:<br>
<input name="lname1" type="text" id="lname1" tabindex="11" value="" size="20" maxlength="22">
<br>
</td>
<td width="75%" height="18" valign="top" class="cpySmall">*First name
1:<br>
<input name="fname1" type="text" id="fname1" tabindex="12" value="" size="20" maxlength="22">
</td>
</tr>
</table>
<div id="continue">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right"> <a href="#approval"><img src="/images/buttons/continue.gif" alt="Continue" name="Continue" width="83" height="17" border="0" onClick="openApprov()"></a>
</tr>
</table>
</div>
<div id="approvSection" style="display: none;" >
<table width="550" border="0" cellspacing="0" cellpadding="2" class="cpyBody">
<tr>
<td width="542" height="24" valign="top" class="cpyHeader1"><a name="approval"></a>Approval
Code</td>
</tr>
<tr valign="top">
<td height="55">Apply this approval code, <b>
<script type="text/javascript"> document.writeln(randomString());</script>
</b>, to your record and issue your tickets. Once completed, provide
the ticket numbers below to validate your request and submit.
<input name="appCode" type="hidden" id="appCode">
</td>
</tr>
<tr valign="top">
<td height="23"><span class="cpyHeader2">Enter Ticket Numbers</span></td>
</tr>
</table>
<table width="550" border="0" cellspacing="0" cellpadding="0" id="ticketSet">
<tr>
<td><span class="cpySmall">Passenger 1:</span><br>
<input name="tn1" type="text" id="tn1" tabindex="1" value="" size="20" maxlength="22">
</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="right"><a href="#confirm"><img src="/images/buttons/continue.gif" value="click" alt="Continue" width="83" height="17" border="0" onclick="reviewConfirm()"></a></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="reviewConfirm" style="display: none;">
<table width="608" border="0" cellpadding="5" cellspacing="1" class="tblBorder">
<tr>
<td height="434" class="tblWhite">
<table width="608" border="0" cellspacing="1" cellpadding="0">
<tr>
<td height="422" valign="top">
<table width="550" border="0" cellpadding="0" cellspacing="0" class="cpyBody">
<tr>
<td height="26" colspan="2" valign="top"><span class="cpyHeader1"><a name="confirm"></a>Confirm
Your Request</span></td>
</tr>
<tr>
<td colspan="2">Before you submit your request, please confirm your
entries below for accuracy. You can change any information by using
the back button below.</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td height="25" colspan="2" valign="top" class="cpyHeader2">Agency
Information</td>
</tr>
<tr>
<td width="148" height="20">Agency name:</td>
<td width="402" height="20" id="confirmation1"> </td>
</tr>
<tr>
<td height="20">ARC/IATA number:</td>
<td height="20" id="confirmation2"> </td>
</tr>
<tr>
<td height="20">E-mail address:</td>
<td height="20" id="confirmation3"> </td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td height="25" colspan="2" valign="top" class="cpyHeader2">Itinerary
Details</td>
</tr>
<tr>
<td height="20">Date booked:</td>
<td height="20" id="confirmation4"> </td>
</tr>
<tr>
<td height="20">Record locator:</td>
<td height="20" id="confirmation5"> </td>
</tr>
<tr>
<td height="20">Number of passengers:</td>
<td height="20" id="confirmation6"> </td>
</tr>
<tr>
<td height="20">Flight number:</td>
<td height="20" id="confirmation7"> </td>
</tr>
<tr>
<td height="20">Departure date:</td>
<td height="20"> </td>
</tr>
<tr>
<td height="20">Departure city:</td>
<td height="20" id="confirmation8"> </td>
</tr>
<tr>
<td height="20">Fare basis:</td>
<td height="20" id="confirmation9"> </td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
<table width="550" border="0" cellpadding="0" cellspacing="0">
<tr valign="top" class="cpyBody">
<td width="50%" height="25" class="cpyHeader2">Passenger Name(s)</td>
<td width="50%" height="25" class="cpyHeader2">Ticket Number(s)</td>
</tr>
<tr class="cpyBody">
<td height="20" id="confirmation10"> </td>
<td height="20" id="confirmation11"> </td>
</tr>
<tr class="cpyBody">
<td height="20" colspan="2" class="cpyHeader2" id="confirmation10">Approval Code</td>
</tr>
<tr class="cpyBody">
<td height="20" colspan="2" id="confirmation29"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right"><img name="back" src="/images/buttons/back.gif" width="62" height="17" alt="Back">
<input name="SUBMIT" type="IMAGE" tabindex="21" value="Submit" src="/images/buttons/submit.gif" alt="Submit" width="67" height="17" border="0">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>