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:
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...
when he clicks on the link he will be redirected to "fonts.html"
this is a pretty tall order. are you opening "fonts.html" in a popup window? if so, making "document.getElementById('fimg').src" have a new SRC would be easy because the "fonts.html" popup window would be a child of the "index.php" window and we could easily reference elements in the "index.php" window.
if you just have a straight HREF redirection, the only way to pass information back to "index.php" would be through the use of some type of "query string", which would require "index.php" to have special javascript syntax in order to parse and utilize.
so the first question is "are you opening "fonts.html" in a popup window?"
1. If you reply to my post, and your reply would then appear directly beneath my post, DON'T QUOTE MY ENTIRE POST!!! IT'S REDUNTANT!!! IT'S ASININE!!!! IT'S REDUNDANTLY ASININE!!!!! DON'T DO IT!!!!
2. jQuery extends the functionality of JavaScript. If you don't know JavaScript, give up on that jQuery script and learn JavaScript. You'll save yourself a lot of frustration, I promise.
3. Use the [code][/code] tags. Otherwise, you may be left wondering why no one responded to your eyesore of a thread.
Bookmarks