Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q75 How can I append a stock symbol from a form to a URL to load four documents in a frameset?

You are here: irt.org | FAQ | JavaScript | Link | Q75 [ previous next ]

If you pass the stock name as a search parameter, i.e. append with a '?' then you can retrieve this information when creating the frameset. For example if the original form looked something like this:

<form name="formName" onSubmit="return displayURL(document.formName)">
<input type="text" name="urladdr" size="10">
</form>

<script language="JavaScript"><!--
function displayURL(item) {
    urlWindow = window.open('','ReportWindow');
    urlWindow.location.href = 'frame.html' + '?' + item.urladdr.value;
    return false;
}
//--></script>

Then the frame.html document could look like this:

<html>

<script language="JavaScript"><!--

var parameter = location.search.substring(1);

var url1 = "http://xxx.xxx.xxx/earnings/" + parameter;
var url2 = "http://xxx.xxx.xxx/estimates/" + parameter;
var url3 = "http://xxx.xxx.xxx/graphs/" + parameter;
var url4 = "http://xxx.xxx.xxx/news/" + parameter;

document.write('<frameset rows="50%,50%">');
    document.write('<frameset cols="50%,50%">');
        document.write('<frame src="' + url1 + '">');
        document.write('<frame src="' + url2 + '">');
    document.write('<\/frameset>');
    document.write('<frameset cols="50%,50%">');
        document.write('<frame src="' + url3 + '">');
        document.write('<frame src="' + url4 + '">');
    document.write('<\/frameset>');
document.write('<\/frameset>');

//--></script>

</html>

©2018 Martin Webb