how to Submit values to JavaScript using two pages..?
Hello webmasters Iam trying to submit values to java script using two pages "index.php" and "fonts.html".
here is the java script code that i have used in index.php
Code:
<script language=javascript>
var cp = new ColorPicker();
var fp = new FontPicker('window');
function pickFont(font) {
document.getElementById('fimg').src='http://example.com/im/font/' + font + '.png';
document.getElementById('fid').value=font;
}
if (document.getElementById('fid').value) {
pickfont(document.getElementById('fid').value);
}
</script>
the values should be submitted from "fonts.html" which has the code:
Code:
<body>
<p><form method=get action="/fonts.html" style="display:inline"><input type=submit name=cat value="Favorites"></form>
<div id="Favorites">
<A HREF="#" onClick="window.opener.FontPicker_pickFont(Times-Roman,window); return false;" STYLE="text-decoration:none;"><img alt="Times-Roman " style="border: outset 1pt" border=1 vspace=1 hspace=1 src="http://www.example.com/im/font/Times-Roman.png"></a>
<A HREF="#" onClick="window.opener.FontPicker_pickFont(ariel,window); return false;" STYLE="text-decoration:none;"><img alt="ariel " style="border: outset 1pt" border=1 vspace=1 hspace=1 src="http://www.example.com/im/font/font/ariel.png"></a>
</div>
</body>
When user opens index.php he will get a link when he clicks on the link he will be redirected to "fonts.html" where he gets an option to click on one of images "Times-Roman.png" and "ariel.png" .
Now what iam trying to do two things
1]when the user clicks on "Times-Roman.png". '('fimg').src' should get the location of "Times-Roman.png"
and
2]"('fid').value" should hold the value "Times-Roman.ttf"
I know this can be implemented by adding javascript code in the second page "fonts.html" but not exactly getting the code your response much appreciated...