For some reason I am getting an error in FireFox only:
Typeerror: document.forms.myCity.optionname is undefined
The script works in all the other browsers:
function WriteCookie()
{
document.cookie = city + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
cookievalue = document.forms['myCity'].optionname.value + ;;
document.cookie='city='+cookievalue +'; expires=Fri, 3 Aug 2021 20:47:11 UTC; path=/';
window.location.href = http://mywebsite.com;
}
This script is in the header and is executed by this form:
<form name=myCity action=http://mywebsite.com/ method=POST>
<?php
function get_terms_dropdown($taxonomies, $args){
$myterms = get_terms($taxonomies, $args);
$optionname = optionname;
$emptyvalue = ;
$output =<select name='. $optionname .'><option selected='. $selected . ' value=' . $emptyvalue . '>Select a City</option>';
foreach($myterms as $term){
$term_taxonomy=$term->pa_city; //CHANGE ME
$term_slug=$term->slug;
$term_name =$term->name;
$link = $term_slug;
$output .=<option name='.$link.' value='.$link.'>.$term_name.</option>;
}
$output .=</select>;
return $output;
}
$taxonomies = array('pa_city');
$args = array('order'=>'ASC','hide_empty'=>true);
echo get_terms_dropdown($taxonomies, $args);
?>
<input type=submit value=click name=submit onclick=WriteCookie()>
</form>
The error is only in FireFox, any ideas?