/    Sign up×
Community /Pin to ProfileBookmark

Passing values between webpages.

Hi everyone.
Does anyone know how to pass a string/value from one webpage to another? Sorrie coz I am really new at this.

I wanted to click a link and open a new window that has the required file (can be any file depending on what link is clicked) loaded into the mainFrame and a header file (which is fix) into the topFrame.

cheers…

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@swonDec 14.2002 — Hi,

use forms?

if yes, try to get the value/string and make following code:

thevalue = document.form.field.value;

window.location.href = "anysite.html?string="+thevalue;


regards

swon
Copy linkTweet thisAlerts:
@bullzzzauthorDec 14.2002 — What if I am using links already? Can i use this link to run a javascript function to pass the value instead? Not very clear here.
Copy linkTweet thisAlerts:
@swonDec 14.2002 — BullzzZ

show me your code and tell me which value you want to pass to next site.



swon
Copy linkTweet thisAlerts:
@bullzzzauthorDec 14.2002 — For example, (not sure how to write the real code)

<script language="JavaScript" type="text/javascript">

function pageClick(Page){

[I]"How do I write the codes to open a new window with FRAMEPAGE.HTML (with topFrame & mainFrame) with the mainFrame to open FILE101.HTML?"[/I]

}

</script>

<ol>

<li><a href="FRAMEPAGE.HTML" onClick="pageClick(FILE101)">File 101</a></li>

<li><a href="FILE202.HTML">File 202</a></li>

<li><a href="FILE303.HTML">File 303</a></li>

<li><a href="FILE404.HTML">File 404</a></li>

</ol>

something like this...

cheers
Copy linkTweet thisAlerts:
@swonDec 14.2002 — Try something like this:

<script language="JavaScript" type="text/javascript">

function pageClick(Page){

var w = window.open();

w.document.open();

w.document.write("<html><head></head><frameset rows="30%,70%"><frame name=top src="top.html"><frame name=main src=""+Page+".html"></frameset></html>");

w.document.close();

}

</script>

<body>

<ol>

<li><a href="FRAMEPAGE.HTML" onClick="pageClick('FILE101')">File 101</a></li>

<li><a href="FILE202.HTML">File 202</a></li>

<li><a href="FILE303.HTML">File 303</a></li>

<li><a href="FILE404.HTML">File 404</a></li>

</ol>

</body>




-----------------------

regards

Swon
Copy linkTweet thisAlerts:
@bullzzzauthorDec 15.2002 — Thanks swon for your assistance. It works perfectly fine. But now I realise that the coding is actually in CGI script. I have posted a message under the CGI topic. Hope you could help. Thank you very much.

http://forums.webdeveloper.com/showthread.php?s=&threadid=1022
×

Success!

Help @bullzzz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...