S
saraerensoy
Someone pls tell me what i'm doing wrong. I can't compare my form
fields and i tried using the values i put in the hidden field and just
using the array values i set up. here's the code from form 1 and form
2.
ad>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"
/>
<title> Login- </title>
<script type="text/javascript">
<!--
function checkForm()
{
if (document.login_form.full_name.value == " ")
window.alert("Fill in name");
else if (document.login_form.ID.value == " ")
document.login_form.action = "error.htm";
else if (document.login_form.password.value == " ")
document.login_form.action = "error.htm";
else if (document.login_form.password.value !=
document.login_form.password2.value)
document.login_form.action = "error.htm";
else if (document.login_form.currency_amount.value == " ")
document.login_form.action = "error.htm";
else if (document.login_form.currency.value == "Type")
document.login_form.action = "error.htm";
else (document.login_form.returned_currency.value == "Type")
document.login_form.action = "error.htm";
}
// -->
</script>
</head>
<body>
<form name="login_form" action="currency.htm" id="login_form"
method="get"
enctype="application/x-www-form-urlencoded"
onsubmit="checkForm()">
<p><span style="color:#FF0000">*</span> Name:
<input type="text" id="full_name" name="full_name" size="50"
/>
<span style="color:#FF0000">*</span>ID:
<input type="text" id="idname" name="idname" size="20" /></p><p>
<span style="color:#FF0000">*</span>Password :
<input type="text" id="password" name="password" size="50" /></p><p>
<span style="color:#FF0000">*</span>Password Check :
<input type="text" id="password2" name="password2" size="50" /></p>
<span style="color:#FF0000">*</span>Currency Amount :
<input type="text" id="currency_amount" name="currency_amount"
size="20" />
<span style="color:#FF0000">*</span>Currency Type:
<select id="currency" name="currency">
<option selected="selected" value="Type">Type</option>
<option value="US">US Dollar</option>
<option value="Australian ">Australian Dollar</option>
<option value="Canadian">Canadian Dollar</option>
</select>
<p>
<span style="color:#FF0000">*</span>Currency Return Type:
<select id="returned_currency" name="returned_currency">
<option selected="selected" value="r_type">Type</option>
<option value="US">US Dollar</option>
<option value="Australian ">Australian Dollar</option>
<option value="Canadian">Canadian Dollar</option>
</select>
<p><button type="submit" onsubmit="checkForm()">Submit</button>
<p><button type="submit" onsubmit="checkForm()">Submit</button>
//// form 2////
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"
/>
<title>Currency - Sara Erensoy</title>
<script type="text/javascript">
<!--
function getcurrency20()
{
//var formInfo = location.search;
var amount = 0;
if (formArray[5] == "US" && formArray[6] == "US")
amount = formArray[4] * 20
document.writeln("This is the amount" + amount)
////////////////////document.writeln(document.currencyform.currency.value)
/*
var amount = 0;
if (document.currencyform.currency.value == "US" &&
document.currencyform.returned_currency.value == "US")
{
amount = document.currencyform.currency_amount.value;
document.writeln("The converted amount is:" + amount)
}
else if (document.login_form.currency.value == US &&
document.login_form.returned_currency.value == Australian)
amount = document.login_form.currency_amount.value * 1.34423;
else if (document.login_form.currency.value == US &&
document.login_form.returned_currency.value == Canadian)
amount = document.login_form.currency_amount.value * 1.13499;
else (document.login_form.currency.value == Canadian &&
document.login_form.returned_currency.value == Canadian)
amount = document.login_form.currency_amount.value;
else if (document.login_form.currency.value == Canadian &&
document.login_form.returned_currency.value == US)
amount = document.login_form.currency_amount.value * 0.88138;
else if (document.login_form.currency.value == Canadian &&
document.login_form.returned_currency.value == Australian)
amount = document.login_form.currency_amount.value * 1.18477;
else if (document.login_form.currency.value == Australian &&
document.login_form.returned_currency.value == Australian)
amount = document.login_form.currency_amount.value;
else if (document.login_form.currency.value == Australian &&
document.login_form.returned_currency.value == US)
amount = document.login_form.currency_amount.avalue * .74412;
else (document.login_form.currency.value == Australian &&
document.login_form.returned_currency.value == Canadian)
amount = document.login_form.currency_amount.value * .84457;
/*
var amount;
if (formArray[5] == US && formArray[6] == US)
amount = formArray[4] ;
*/
//document.writeln("The converted amount is:" + amount)
// document.writeln(getcurrency())
//return amount;
}
function getValue(query)
{
var qstring = query.indexOf("=")
return qstring <0 ? query : query.substring(qstring + 1, query.length)
}
function Filler()
{
var formInfo = location.search;
formInfo = formInfo.substring(1, formInfo.length);
while (formInfo.indexOf("+") != -1)
{
formInfo = formInfo.replace("+", " ");
}
formInfo = unescape(formInfo);
var dataArray = formInfo.split("&");
document.currencyform.full_name.value=extractValue(dataArray[0] );
document.currencyform.idname.value=extractValue(dataArray[1] );
document.currencyform.password.value=extractValue(dataArray[2]);
document.currencyform.passsword2.value=extractValue(dataArray[3]);
document.currencyform.currency_amount.value=extractValue(dataArray[4]);
document.currencyform.currency.value=extractValue(dataArray[5]);
document.currencyform.returned_currency.value=extractValue(dataArray[6]);
}
</script>
</head>
<body onload="Filler()">
<form name="currencyform" action="mailto:[email protected]?subject=Currency"
method="post" enctype="text/plain">
<script type="text/javascript">
// <!--
var formInfo = location.search;
formInfo = formInfo.substring(1, formInfo.length)
while (formInfo.indexOf("+") != -1)
formInfo = formInfo.replace("+", " ")
formInfo = unescape(formInfo);
var formArray = formInfo.split("&")
//var sizeArray = formArray.length
//for (var i =0; i<sizeArray; ++i)
document.write("Here is what you entered" + "<br / >");
document.write(formArray[0] + "<br / >");
document.write(formArray[4] + "<br / >");
document.write(formArray[5] + "<br / >");
document.write(formArray[6] + "<br / >");
var amount = 0;
//var full_amount = 0;
Currency_array = formArray[4]
amount = Currency_array.substring(16, formInfo.length)
full_amount = (parseInt(amount) )
//document.writeln("PLS WORK: " + full_amount)
///////////////CONVERSION//////////////////////
CTypeArray = formArray[5]
RTypeArray = formArray[6]
/////document.writeln("FIRST: " + CTypeArray) //////test
////////document.writeln("RFIRST : " + RTypeArray) //////test
country = CTypeArray.substring(9, formInfo.length)
rcountry = RTypeArray.substring(18, formInfo.length)
document.writeln("SECOND: " + country) //////test
document.writeln("RSECOND: " + rcountry) //////test
if ( (country == "US") && (rcountry == "US") )
full_amount = full_amount;
else if ( (country == "US") && (rcountry == "Australian") )
{
document.writeln(" US TO AUSTRALIAN")
full_amount = (full_amount * 1.134423);
}
else if (country == "US" && rcountry == "Canadian")
full_amount = full_amount * 1.13499;
/////////////////////////////////
else if (country == "Australian" && rcountry == "Australian")
full_amount = full_amount;
else if (country == "Australian" && rcountry == "Canadian")
full_amount = full_amount * .84457;
else if (country == "Australian" && rcountry == "US")
full_amount = full_amount * 74412;
/////////////////////////////////////
else if (country == "Canadian" && rcountry == "Canadian")
full_amount = full_amount;
else if (country == "Canadian" && rcountry == "US")
full_amount = full_amount * 1.13499;
else if (country == "Canadian" && rcountry == "Australian")
full_amount = full_amount * 1.18477;
document.writeln("The amount is: " + full_amount.toFixed(2))
document.writelin("Hidden" + document.currencyform.idname.value)
</script>
<input type="hidden" name="full_name" />
<input type="hidden" name="idname" />
<input type="hidden" name="currency_amount" />
<input type="hidden" name="currency" />
<input type="hidden" name="returned_currency" />
</form>
</body>
</html>
fields and i tried using the values i put in the hidden field and just
using the array values i set up. here's the code from form 1 and form
2.
ad>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"
/>
<title> Login- </title>
<script type="text/javascript">
<!--
function checkForm()
{
if (document.login_form.full_name.value == " ")
window.alert("Fill in name");
else if (document.login_form.ID.value == " ")
document.login_form.action = "error.htm";
else if (document.login_form.password.value == " ")
document.login_form.action = "error.htm";
else if (document.login_form.password.value !=
document.login_form.password2.value)
document.login_form.action = "error.htm";
else if (document.login_form.currency_amount.value == " ")
document.login_form.action = "error.htm";
else if (document.login_form.currency.value == "Type")
document.login_form.action = "error.htm";
else (document.login_form.returned_currency.value == "Type")
document.login_form.action = "error.htm";
}
// -->
</script>
</head>
<body>
<form name="login_form" action="currency.htm" id="login_form"
method="get"
enctype="application/x-www-form-urlencoded"
onsubmit="checkForm()">
<p><span style="color:#FF0000">*</span> Name:
<input type="text" id="full_name" name="full_name" size="50"
/>
<span style="color:#FF0000">*</span>ID:
<input type="text" id="idname" name="idname" size="20" /></p><p>
<span style="color:#FF0000">*</span>Password :
<input type="text" id="password" name="password" size="50" /></p><p>
<span style="color:#FF0000">*</span>Password Check :
<input type="text" id="password2" name="password2" size="50" /></p>
<span style="color:#FF0000">*</span>Currency Amount :
<input type="text" id="currency_amount" name="currency_amount"
size="20" />
<span style="color:#FF0000">*</span>Currency Type:
<select id="currency" name="currency">
<option selected="selected" value="Type">Type</option>
<option value="US">US Dollar</option>
<option value="Australian ">Australian Dollar</option>
<option value="Canadian">Canadian Dollar</option>
</select>
<p>
<span style="color:#FF0000">*</span>Currency Return Type:
<select id="returned_currency" name="returned_currency">
<option selected="selected" value="r_type">Type</option>
<option value="US">US Dollar</option>
<option value="Australian ">Australian Dollar</option>
<option value="Canadian">Canadian Dollar</option>
</select>
<p><button type="submit" onsubmit="checkForm()">Submit</button>
<p><button type="submit" onsubmit="checkForm()">Submit</button>
//// form 2////
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"
/>
<title>Currency - Sara Erensoy</title>
<script type="text/javascript">
<!--
function getcurrency20()
{
//var formInfo = location.search;
var amount = 0;
if (formArray[5] == "US" && formArray[6] == "US")
amount = formArray[4] * 20
document.writeln("This is the amount" + amount)
////////////////////document.writeln(document.currencyform.currency.value)
/*
var amount = 0;
if (document.currencyform.currency.value == "US" &&
document.currencyform.returned_currency.value == "US")
{
amount = document.currencyform.currency_amount.value;
document.writeln("The converted amount is:" + amount)
}
else if (document.login_form.currency.value == US &&
document.login_form.returned_currency.value == Australian)
amount = document.login_form.currency_amount.value * 1.34423;
else if (document.login_form.currency.value == US &&
document.login_form.returned_currency.value == Canadian)
amount = document.login_form.currency_amount.value * 1.13499;
else (document.login_form.currency.value == Canadian &&
document.login_form.returned_currency.value == Canadian)
amount = document.login_form.currency_amount.value;
else if (document.login_form.currency.value == Canadian &&
document.login_form.returned_currency.value == US)
amount = document.login_form.currency_amount.value * 0.88138;
else if (document.login_form.currency.value == Canadian &&
document.login_form.returned_currency.value == Australian)
amount = document.login_form.currency_amount.value * 1.18477;
else if (document.login_form.currency.value == Australian &&
document.login_form.returned_currency.value == Australian)
amount = document.login_form.currency_amount.value;
else if (document.login_form.currency.value == Australian &&
document.login_form.returned_currency.value == US)
amount = document.login_form.currency_amount.avalue * .74412;
else (document.login_form.currency.value == Australian &&
document.login_form.returned_currency.value == Canadian)
amount = document.login_form.currency_amount.value * .84457;
/*
var amount;
if (formArray[5] == US && formArray[6] == US)
amount = formArray[4] ;
*/
//document.writeln("The converted amount is:" + amount)
// document.writeln(getcurrency())
//return amount;
}
function getValue(query)
{
var qstring = query.indexOf("=")
return qstring <0 ? query : query.substring(qstring + 1, query.length)
}
function Filler()
{
var formInfo = location.search;
formInfo = formInfo.substring(1, formInfo.length);
while (formInfo.indexOf("+") != -1)
{
formInfo = formInfo.replace("+", " ");
}
formInfo = unescape(formInfo);
var dataArray = formInfo.split("&");
document.currencyform.full_name.value=extractValue(dataArray[0] );
document.currencyform.idname.value=extractValue(dataArray[1] );
document.currencyform.password.value=extractValue(dataArray[2]);
document.currencyform.passsword2.value=extractValue(dataArray[3]);
document.currencyform.currency_amount.value=extractValue(dataArray[4]);
document.currencyform.currency.value=extractValue(dataArray[5]);
document.currencyform.returned_currency.value=extractValue(dataArray[6]);
}
</script>
</head>
<body onload="Filler()">
<form name="currencyform" action="mailto:[email protected]?subject=Currency"
method="post" enctype="text/plain">
<script type="text/javascript">
// <!--
var formInfo = location.search;
formInfo = formInfo.substring(1, formInfo.length)
while (formInfo.indexOf("+") != -1)
formInfo = formInfo.replace("+", " ")
formInfo = unescape(formInfo);
var formArray = formInfo.split("&")
//var sizeArray = formArray.length
//for (var i =0; i<sizeArray; ++i)
document.write("Here is what you entered" + "<br / >");
document.write(formArray[0] + "<br / >");
document.write(formArray[4] + "<br / >");
document.write(formArray[5] + "<br / >");
document.write(formArray[6] + "<br / >");
var amount = 0;
//var full_amount = 0;
Currency_array = formArray[4]
amount = Currency_array.substring(16, formInfo.length)
full_amount = (parseInt(amount) )
//document.writeln("PLS WORK: " + full_amount)
///////////////CONVERSION//////////////////////
CTypeArray = formArray[5]
RTypeArray = formArray[6]
/////document.writeln("FIRST: " + CTypeArray) //////test
////////document.writeln("RFIRST : " + RTypeArray) //////test
country = CTypeArray.substring(9, formInfo.length)
rcountry = RTypeArray.substring(18, formInfo.length)
document.writeln("SECOND: " + country) //////test
document.writeln("RSECOND: " + rcountry) //////test
if ( (country == "US") && (rcountry == "US") )
full_amount = full_amount;
else if ( (country == "US") && (rcountry == "Australian") )
{
document.writeln(" US TO AUSTRALIAN")
full_amount = (full_amount * 1.134423);
}
else if (country == "US" && rcountry == "Canadian")
full_amount = full_amount * 1.13499;
/////////////////////////////////
else if (country == "Australian" && rcountry == "Australian")
full_amount = full_amount;
else if (country == "Australian" && rcountry == "Canadian")
full_amount = full_amount * .84457;
else if (country == "Australian" && rcountry == "US")
full_amount = full_amount * 74412;
/////////////////////////////////////
else if (country == "Canadian" && rcountry == "Canadian")
full_amount = full_amount;
else if (country == "Canadian" && rcountry == "US")
full_amount = full_amount * 1.13499;
else if (country == "Canadian" && rcountry == "Australian")
full_amount = full_amount * 1.18477;
document.writeln("The amount is: " + full_amount.toFixed(2))
document.writelin("Hidden" + document.currencyform.idname.value)
</script>
<input type="hidden" name="full_name" />
<input type="hidden" name="idname" />
<input type="hidden" name="currency_amount" />
<input type="hidden" name="currency" />
<input type="hidden" name="returned_currency" />
</form>
</body>
</html>