The other important thing is that each input needs an id.
Before you had:
<input type="hidden" name="hometown" >
Which is no good you need:
<input type="hidden" name="hometown" id="hometown" value="">
Your javascript will be as follows:
<script language="JavaScript">
<!--//
function hometownBuild() {
var city = document.getElementById('c
var state = document.getElementById('s
var hometown = document.getElementById('h
var country = document.getElementById('c
hometown.value = city.value + '|' + state.value + '|' + country.value;
}
function birthdayBuild() {
var birthday = document.getElementById('b
var byear = document.getElementById('b
var bmonth = document.getElementById('b
var bday = document.getElementById('b
birthday.value = byear.value + '|' + bmonth.value + '|' + bday.value;
}
function schoolBuild() {
var schools = document.getElementById('s
var school1 = document.getElementById('s
var school2 = document.getElementById('s
var school3 = document.getElementById('s
birthday.schools = school1.value + '|' + school2.value + '|' + school3.value;
}
//--></script>
Your HTML:
<select name="bmonth" class="month" id="bmonth" onchange="birthdayBuild();
<option value="01">January</option
<option value="02">February</optio
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</opti
<option value="10">October</option
<option value="11">November</optio
<option value="12">December</optio
</select>
<select name="bday" class="dateyear" id="bday" onchange="birthdayBuild();
<?
for ($i = 1; $i <= 31; $i++)
{
?>
<option value="<? echo $i; ?>" ><? echo $i; ?></option>
<?
}
?>
</select>
<select name="byear" class="dateyear" id="byear" onchange="birthdayBuild();
<?
for ($i = 2007; $i >= 1900; $i--)
{
?>
<option value="<? echo $i; ?>" ><? echo $i; ?></option>
<?
}
?>
</select>
<input type="text" name="birthday" id="birthday" value="">
<input name="city" type="text" class="textfield3" id="city" onchange="hometownBuild();
<select name="state" class="dateyear" id="state" onchange="hometownBuild();
<option value="AL">AL</option>
<option value="AK">AK</option>
<option value="AZ">AZ</option>
<option value="AR">AR</option>
<option value="CA">CA</option>
</select>
<input name="country" type="text" class="textfield3" id="country" onchange="hometownBuild();
<input type="text" name="hometown" id="hometown" value="">
Main Topics
Browse All Topics





by: ncooPosted on 2007-06-05 at 13:16:02ID: 19220306
You need to use getElementById.
ity'); tate'); ometown'); ountry');
"> "> ">
You would use it like this, that will work in firefox.
<html>
<head>
<script language="JavaScript">
<!--//
function hometownBuild() {
var city = document.getElementById('c
var state = document.getElementById('s
var hometown = document.getElementById('h
var country = document.getElementById('c
hometown.value = city.value + '|' + state.value + '|' + country.value;
}
//--></script>
</head>
<body>
<input name="city" type="text" class="textfield3" id="city" onchange="hometownBuild();
<select name="state" class="dateyear" id="state" onchange="hometownBuild();
<option value="AL">AL</option>
<option value="AK">AK</option>
<option value="AZ">AZ</option>
<option value="AR">AR</option>
<option value="CA">CA</option>
</select>
<input name="country" type="text" class="textfield3" id="country" onchange="hometownBuild();
<input type="text" name="hometown" id="hometown" value="">
</body>
</html>