JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2061
Number of posts: 5164

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Sending parameters Posted by javierete on 2 Oct 2002 at 7:59 AM
How can I send values from one page to another with javascript??
Report
Re: Sending parameters Posted by bgibby on 2 Oct 2002 at 5:25 PM
: How can I send values from one page to another with javascript??
:

Send the data as a Query String.

Page 1:


<html>
<head>
<script language="JavaScript">

function sendData() {
var data = document.mf.data.value;
var url = "page2.html";

document.location.href = url + "?" + data;
return false;

}

</script>
</head>
<body>
<form name="mf" onSubmit="return sendData();">
Data to Send: <input type="text" name="data" size="25"> <input type="submit" value="Send Data">
</form>
</body>
</html>



Page 2:


<html>
<head>
<script language="JavaScript">

var receivedData = document.location.search.substring(1, document.location.search.length);

</script>
</head>
<body>

The data that was sent to this page is: 
<script language="JavaScript">
document.write(receivedData);
</script>

</body>
</html>



You can write the code to seperate the Key/Value pairs!

Cya
Bradley q:)
Report
Re: Sending parameters Posted by mac_doggie on 15 Oct 2002 at 7:27 AM
: How can I send values from one page to another with javascript??
:

I've created a script that allows you to send variables like this:
document.location.href=MyPage.html?Variable1=value&variable2=value&variable3=value etc.


just download it from my homepage www.mac-doggie.nl

-mac-
mailto:programmersheaven@mac-doggie.nl
the Netherlands...


Report
Re: Sending parameters Posted by borislav on 24 Oct 2002 at 4:40 AM
: How can I send values from one page to another with javascript??
:
The both methods have a weak sides the user see the sending data onto browse address bar also the better way to send data to one page may be done by 2 additional ways. Or simply using the Post methods to hide data from browser location bar. Also escape characters are not interpreted well which give possibility of hackers attacks.
Better and easy way to use document cookies.
Remember that boys when you want your sites to be better secured.





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.