DJWiktor
09-18-2005, 02:17 AM
Hi,
I have two dropdown lists dynamically populated from db.
<form name="form" id="form" method="post" action="javascript:ReloadPage();">
<select name="branza" id="branza">
<option value="value1">name1</option>
<option value="value2">name2</option>
<option value="value3">name3</option>
<option value="value4">name4</option>
...
</select>
<select id="woj" name="woj">
<option value="value1">name1</option>
<option value="value2">name2</option>
<option value="value3">name3</option>
<option value="value4">name4</option>
...
</select>
<input type="submit" name="Submit" value=">">
</form>
Then i use the ReloadPage() function to replace the current url with a new one and refresh the page contents:
<script language="JavaScript">
<!---
function ReloadPage(){
location.replace("http://www.mypage.com/index.php?branza="+document.getElementById['branza'].value+"&woj="+document.getElementById['woj'].value);
}
//--->
</script>
To my surprise I get js error:
document.getElementById.branza has no properties
Should be simple to do, but can't cope with it.
Can anyone show me where the mistake is?
Witold
I have two dropdown lists dynamically populated from db.
<form name="form" id="form" method="post" action="javascript:ReloadPage();">
<select name="branza" id="branza">
<option value="value1">name1</option>
<option value="value2">name2</option>
<option value="value3">name3</option>
<option value="value4">name4</option>
...
</select>
<select id="woj" name="woj">
<option value="value1">name1</option>
<option value="value2">name2</option>
<option value="value3">name3</option>
<option value="value4">name4</option>
...
</select>
<input type="submit" name="Submit" value=">">
</form>
Then i use the ReloadPage() function to replace the current url with a new one and refresh the page contents:
<script language="JavaScript">
<!---
function ReloadPage(){
location.replace("http://www.mypage.com/index.php?branza="+document.getElementById['branza'].value+"&woj="+document.getElementById['woj'].value);
}
//--->
</script>
To my surprise I get js error:
document.getElementById.branza has no properties
Should be simple to do, but can't cope with it.
Can anyone show me where the mistake is?
Witold