Javascript help - form script

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
JKM
Forum Contributor
Posts: 221
Joined: Tue Jun 17, 2008 8:12 pm

Javascript help - form script

Post by JKM »

Hi there,

I got this code for a form to update the variable 'num' without reloading the page:

Code: Select all

var choose = document.getElementById("demovis");
choose.onchange = function() {
    var num = this.options[this.selectedIndex];
    if(num.value != "blank" ){
        window.location = "index.php?num="+num.value;
    }
}
Now, I want another select field, and when you select something in one of the fields, it should get values from both fields. index.php?num=XX&page=XX.
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: Javascript help - form script

Post by kaszu »

to update the variable 'num' without reloading the page
That code reloads the page :)

You already have the code needed, just change it to take 2 selects.
Try finding what on each of code lines is done and if you still can't get it to work, then post what you tried or maybe some ideas how you think that could be done and I'll help, but just writing code for you in my opinion is pointless.

Sorry if it sounds rude, I don't mean it like that.
Post Reply