2 questions [1]document.write & [2]summation of variables amoung forms ---- thanks
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   havey_h
Posted On:   Friday, January 17, 2003 12:00 AM

[1]form1 value is passed to form2 (Education.htm) via GET method: document.location="Education.htm?"+document.f1.age.value; Education.htm url checks out: http://www.company.com/Education.htm?age=10 now how would i write this value visually to the Education.htm? I've been playing around like, document.write(+ age +), but nothing seems to work. [2]After submitting the Education.htm form, i would like to add the selected value from Education.htm to age value and then pass this new summation as a value to form3.htm. I can't use frames. and i dont need the field names to be passed along. any suggestions for this newbie, thnks    More>>

[1]form1 value is passed to form2 (Education.htm) via GET method:
document.location="Education.htm?"+document.f1.age.value;

Education.htm url checks out:
http://www.company.com/Education.htm?age=10

now how would i write this value visually to the Education.htm?
I've been playing around like, document.write(+ age +), but nothing seems to work.

[2]After submitting the Education.htm form, i would like to add the selected value from Education.htm to age value and then pass this new summation as a value to form3.htm.

I can't use frames. and i dont need the field names to be passed along.
any suggestions for this newbie, thnks

   <<Less

Re: 2 questions [1]document.write & [2]summation of variables amoung forms ---- thanks

Posted By:   Nitesh_Naveen  
Posted On:   Friday, January 17, 2003 03:15 AM

1. First of all the method shoud be document.location="Education.htm?age="+document.f1.age.value...

document.write(age) will not work... it is a parameter that you will have to get using either the server side scripting or using javascript. Easier using serverscript like
document.write("<%= request.getParameter("age") %>")

or using javascript like
var loc=""+document.location;
loc = loc.indexOf("?age=")!=-1?loc.substring(loc.indexOf("?age=")+5,loc.length):"";
var age = loc.indexOf("&")!=-1?loc.substring(0,loc.indexOf("&")):loc;
document.write(age);


2.I guess what you need to do is to get a selected value in education.htm, add this to the age and then pass it on to the next page (or is it in the same page?). If it is in the next page you will have to pass the value either as a parameter like
var sum = document.f1.age.value+document.f1.select1.options[document.f1.select1.selectedIndex].value;
document.location="form3.htm?sum"+sum
or you can have a hidden filed in this form and set the value of this and submit.
In case you need to change this in the same page you need to have this value displayed within a DIV and change the content of the DIV in the onchange of the select.
About | Sitemap | Contact