Hi!
you don't want to work with iframes, since old netscape browsers don't understand them and there still seem to be some of those around among mac users... so careful with that.
code sample:
why not doing it directly by creating a form consisting entirely of hidden fields somewhere and sending it directly?
code:
// lets say your form is in frame 0 of your (1D) framework and youve got only 1 form in there
//config: if all elements are used up, send form and reset for new chioces
var_elements_usedup = "submit";
var_remember_elemid = 0;
function func_on_change_list(){
//change value of forms but have a look whether there are
//enough "empty" elements in target form
if(var_remember_elemid < parent.frames[0].forms[0].elements.length){
//chage values
parent.frames[0].forms[0].elements[var_remember_elemid].value = document.forms[0].elements[number_of_list].value;
}else{
//if we want to receive more choices we send the form as soon its full and reset it
if(var_elements_usedup == "submit"){
parent.frames[0].forms[0].submit();
parent.frames[0].forms[0].reset();
}else{
//output feedback max nr. of choices has been reached
alert("You've already made the maximum number of choices");
}
}
var_remember_elemid++;
}
//just in case we need it:
function func_on_submit(){
parent.frames[0].forms[0].submit();
}
since you might want to have the variables in php somewhat dependent on what value has been sent you of course can change not only value but name of the element as well...
this would give the user of the form some more freedom...
especially if you want to play around with dHTML dont need a "sending" form at all any more, since javascript doesnt care where the values come from....
so if you give 2 arguments to func_on_change_list(), namely the name the next element should get and the value you want to have it you can fill your form by any action the user takes...
clicking on images for example, but it doesnt really matter.
especially if you use the "always refresh" option you can do this forever.
ah, the code to fill in the name and values in the function:
parent.frames[0].forms[0].elements[var_remember_elemid].name = arg_name;
parent.frames[0].forms[0].elements[var_remember_elemid].value = arg_value;
no realy sweat.
should work.
greetings, jakob