PASS value

Ads
 

PASS value

javascript to pass value to other html file

View Answers

April 7, 2011 at 11:06 AM

1)values.html:

<html>
<script>
function send(){
var f=document.form;
var fname=f.firstname.value;
var lname=f.lastname.value;
window.location.replace("passvalues.html?f="+fname+"&&l="+lname);
}
</script>
<form name="form" action="passvalues.html">
<table>
<tr>
<td>First Name:</td>
<td><input type=text name=firstname size=10></td>
</tr>
<tr>
<td>Last Name:</td>
<td><input type=text name=lastname size=10></td>
</tr>
<tr>
<td colspan=2><input type=button value="Submit" onclick="send();">
</td>
</tr>
</table>
</form>
</html>

2)passvalues.html:

<html>
<script>
function getParams() {
var idx = document.URL.indexOf('?');
var params = new Array();
if (idx != -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
for (var i=0; i<pairs.length; i++) {
nameVal = pairs[i].split('=');
params[nameVal[0]] = nameVal[1];
   }
}
return params;
}
params = getParams();
</script>
<script>
firstname = unescape(params["f"]);
lastname = unescape(params["l"]);

document.write("Firstname = " + firstname + "<br>");
document.write("Lastname = " + lastname + "<br>");

</script>

Ads









Related Tutorials/Questions & Answers:
PASS value
PASS value  javascript to pass value to other html file
you pass a variable by value.
you pass a variable by value.  How do you pass a variable by value... $a = &$b /*--------------Pass By value----------------*/ function add($a) { return ++$a; } add($a); /*---------------Pass by reference
Advertisements
objective c pass by value
objective c pass by value   How to pass value by reference...; //j now == 23, but this hasn't changed the value of i. } If you wanted to be able to modify i, you would have to pass the value of the reference by doing
Java Pass Value Example
Java Pass Value Example       Pass value from JSP to JavaScript We can also pass the value from a JSP page to the java script as we have done in our
i want to pass Javascript value to JSP scriptlet..
i want to pass Javascript value to JSP scriptlet..  i am having... that i am calling the onchange function. In javascript i am getting the value now i want to pass this value to JSP scriptlet
In Struts 2 how to pass the <s: property value=''
In Struts 2 how to pass the s: property value'  In Struts 2 how to pass the s: property value' I have page where i display the list of treasury, their names. I need to have them as hyperlinks ans on click of A treasury name i
How to pass the value from controller to jsp page ?
How to pass the value from controller to jsp page ?  HI I need to pass the value from controller to jsp. I use the way like this Controller request.setAttribute("msg", "Successfully Login"); In jsp ${msg} and then i
How to pass the value of Selected Value of combo box into sql ??
How to pass the value of Selected Value of combo box into sql ??  My SQL Database Name is MHS, user=root, password=admin,table name is sub_comb(regno,sname,sgen). Now i want to select one "regno" from Combobox and then after
write a program to demonstrate call by value and call by reference.(pass objects as parameters)
write a program to demonstrate call by value and call by reference.(pass objects as parameters)  write a program to demonstrate call by value and call by reference.(pass objects as parameters
how to value of one variable pass in other variable in revetse order
how to value of one variable pass in other variable in revetse order  Like variable a=367 b must have valuev763
Pass value from JSP to JavaScript
Pass value from JSP to JavaScript       We can also pass the value from a JSP page to the java... a function hello() which takes value from the jsp page on click of some button
Pass value of rasio button from jsp page to action class(not conventional problem)
Pass value of rasio button from jsp page to action class(not conventional...;table border="1"> <tbody> <s:iterator value...; <td><s:property value="#id.startTime" /></td>
Pass value from child to parent window
Pass value from child to parent window       Java example program to pass value from child window... and will take the value to pass it on to the parent window. Here is the code
Example program to pass value from Html to java script
Example program to pass value from Html to java script       We can also pass the values from... which will pass the value to the java script function and this value
JSP Value to JavaScript
to pass the value from JSP to JavaScript. The JavaScript create a function..., we are going to pass the jsp value to javaScript. For this we have create...; <html> <head> <title> Pass value from JSP
Can I pass a
Can I pass a   Suppose I have servlet named Name.java and there is a variable String name holding a value "Roseindia". I have collected the value to Getname.jsp via ajax. Now how can I pass this value to scriplet without page
java pass by reference
java pass by reference  i understood java always pass arguments by pass by value so that the original value does not change...... but i want to know how we change the value and make it effect the original value by passing
pass method reference in java
pass method reference in java  How to pass method reference in Java
Is Java pass-by-reference?
Is Java pass-by-reference?  Is Java pass-by-reference
JavaScript pass arguments
JavaScript pass arguments   How to pass dynamic arguments to the functions in JavaScript
Pass message controller to viiew with the help of Model in Spring 3
Pass message from Controller to View with help of Model in Spring 3.0: In this example, we will discuss about the pass message or different types of value...:out value="${nameerror}"/></FONT></td> <
ModuleNotFoundError: No module named 'Pass'
ModuleNotFoundError: No module named 'Pass'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'Pass' How to remove the ModuleNotFoundError: No module named 'Pass' error
ModuleNotFoundError: No module named 'Pass'
ModuleNotFoundError: No module named 'Pass'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'Pass' How to remove the ModuleNotFoundError: No module named 'Pass' error
How to pass javascript variable in Scriplet of JSP?
How to pass javascript variable in Scriplet of JSP?  How can I assign the value of a javascript variable to a variable declared in jsp scriplet? Is it possible
Pass value from iframe to parent
Pass value from iframe to parent   ... page. We can pass values from iframe to the parent page with the use of java script.  Here in our example of passing value from iframe to the parent we
How can i pass the valus from a JSP to the action class???
How can i pass the valus from a JSP to the action class???  hewllo wevryone... can anyone help me with how i can pass the value of menuId in my JSP and pass it in the action class
passing value from javascript popup
passing value from javascript popup  How to take user input and pass that input value using popup in Javascript
How to pass multiple values from a servlet to JSP?
How to pass multiple values from a servlet to JSP?  hi, I want to pass multiple values form a servlet to JSP. Hw do i do that? I am able to send one value at a time without any prb, but I am unable to carry multiple (from two
how to pass the parameter in callable statement
how to pass the parameter in callable statement  calstat=conn.prepareCall("{call studentrc(?,?,?,?,?)}"); // it show error parameter value is null...=smark1,mark2=smark2,total=stotal where Regno=Regno; end;// how can i pass the parameter
pass to next page
pass to next page  I am working on a school project no server client side only. 1st page you enter data such as name, address, DoB etc.(textboxes & dropdowns) after clicking submit the data needs to be displayed in a frame
ModuleNotFoundError: No module named 'chrome-pass'
ModuleNotFoundError: No module named 'chrome-pass'  Hi, My Python... 'chrome-pass' How to remove the ModuleNotFoundError: No module named 'chrome-pass' error? Thanks   Hi, In your python environment

Ads