- foreach my $popstate ( sort { $a cmp $b } keys %pop ) {
- $text .= "\nif ( state == \"$popstate\" ) {\n";
+ if ( $init_popstate ) {
+ $text .='<INPUT TYPE="hidden" NAME="init_popstate" VALUE="$init_popstate">';
+ } else {
+ $text .= <<END;
+ function popstate_changed(what) {
+ state = what.options[what.selectedIndex].text;
+ what.form.popnum.options.length = 0;
+ what.form.popnum.options[0] = new Option("", "", false, true);
+END
+
+ foreach my $popstate ( sort { $a cmp $b } keys %pop ) {
+ $text .= "\nif ( state == \"$popstate\" ) {\n";