Click to See Complete Forum and Search --> : Passing values between webpages.
bullzzz
12-14-2002, 08:57 AM
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...
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
bullzzz
12-14-2002, 09:17 AM
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.
BullzzZ
show me your code and tell me which value you want to pass to next site.
swon
bullzzz
12-14-2002, 10:00 AM
For example, (not sure how to write the real code)
<script language="JavaScript" type="text/javascript">
function pageClick(Page){
"How do I write the codes to open a new window with FRAMEPAGE.HTML (with topFrame & mainFrame) with the mainFrame to open FILE101.HTML?"
}
</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
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
bullzzz
12-14-2002, 11:44 PM
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