Javascript variable passing
-
I know have very little programing skills but I am trying to borrow the code from the category drop down widget to make one for tags. I got the code to work so far like this
<script lang=’javascript’><!–
var dropdown = document.getElementById(“products”);
function onCatChange() {
{
location.href = “<?php echo get_option(‘home’);
?>/?tag=”+dropdown.options[dropdown.selectedIndex].value;
}
}
dropdown.onchange = onCatChange;
–></script>It access the tags from the custom form I have created. What I need to do is create a second form so that they would interact like this
<script lang=’javascript’><!–
var dropdown = document.getElementById(“counties”);
function onCatChange() {
{
counties = “+dropdown.options[dropdown.selectedIndex].value;
}
}
dropdown.onchange = onCatChange;
–></script><script lang=’javascript’><!–
county = ‘+’.counties;
var dropdown = document.getElementById(“products”);
function onCatChange() {
{
location.href = “<?php echo get_option(‘home’);
?>/?tag=”+dropdown.options[dropdown.selectedIndex].value.county;
}
}
dropdown.onchange = onCatChange;
–></script>I don’t know how to get the variable counties to pass over to the second script.
Thanks.
- The topic ‘Javascript variable passing’ is closed to new replies.