I tried a quick search and didn't find anything. I'm also new to javascripting (more of an html/css guy). I have a drop down list of about 10 cities. When a user selects a city I'd like for a div under this dropdown box to be populated with a different paragraph/phone number. The paragraph for each city is unique, but static (not database driven). I was thinking of using a function with the onchange event to set this paragraph text, then use maybe a conditional if statement to display the text in the div. Any help would be greatly appreciated. Thanks in advance.
Here is what I have so far:
obviously my borrowed code isn't all the way there.
Here is what I have so far:
Code:
<SCRIPT LANGUAGE=javascript>
function OnChange(loc)
{
alert ("Yay!")
var myindex = loc.selectedIndex
var SelValue = loc.options[myindex].value
var baseURL = "google.com"
document.getElementById('pictitle').innerHTML=baseURL;
return true;
}
</SCRIPT>
<select name="loc" onchange='OnChange(this.form.loc);'>