ilyash
04-10-2003, 05:39 PM
hey im looking for a javascript ...
wut i need is this (bear with me its hard to explain)
when you click on a state it will popup a window ...
the window will ask u to select a city..
lets say u selected "Chicago"
Then the original page will have "Chicago" as the city...
then u finish complteting the corm and submit it...
Thanks,
MikeM
04-10-2003, 06:50 PM
http://javascriptsearch.com/scripts/Forms/country_chooser.html
digitok
04-10-2003, 08:24 PM
Try this
HTML
<select name="city" onChange="popCity(this.value);">
<option value="chicago">Chicago</option>
<option value="chicago">Texas</option>
</select>
JavaScript
<script language="JavaScript">
function popCity(city) {
window.open("http://www.website.com/page.php?city=" + city,"_blank");
}
</script>
Say if you had http://www.website.com/chicago
You'd use "http://www.website.com/" + city
Or if you had http://www.website.com/cities/chicago.html
You'd use "http://www.website.com/cities/" + city + ".html"
Hope it helps.
ilyash
04-11-2003, 06:17 PM
the thing is i dont want to load like 50000 cities at once bcz it will take really long..
i need when u click on the state it will take u to a file using the state as an argument and then it will show just those cities....
i can do that myself ...
but i have to know how to make it when u press submit it will go back into the box on the original site...
jb4mt
04-12-2003, 11:08 AM
From your popup window, you can use Window.opener to refer to the original window. So in your popup you will want an event handler for when a city is chosen, then you should be able to have Javascript code such as:
window.opener.document.forms[0].city.value = popup.document.forms[0].city.value;
popup in the object reference on the right is not strictly necessary by any means, but I've included it for illustrative purposes.
HTH