Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have two pages 'index.php' and 'fonts.html'

here is the javascript code that I have used in index.php:

<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.

<html>
  <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.pickFont('Times-Roman'); 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.pickFont('ariel'); 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>
  </p>
</body>

The above code works fine with the "onClick function".. but I need to use onClick function in such a way after submitting the value, 'fonts.html' should close by itself or else 'it should redirect the page from 'fonts.html' to the page where it has submitted the value.Is there a way to fix it???

your response is appreciated..

share|improve this question
    
Doesn't it do so already? When you click the submit button ("Favorites"), doesn't the page redirect to /fonts.html ? –  David Faux Mar 18 '12 at 21:50
1  
Did you learn it from 10 year old tutorial ? Nobody writes that sort of <strike>crap</strike> code anymore. Start with reading htmldog.com/guides , and then move to eloquentjavascript.net –  tereško Mar 18 '12 at 22:07
    
Iam using different method .. and the problem has been solved ..please close this question. –  Google Mar 18 '12 at 23:48
    
People should really learn to format and ident code from questions. –  MurifoX Jun 10 '13 at 13:43
    
Google it ^^ - sorry –  ggzone Jun 10 '13 at 14:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.