Open new window on keypress is only working in Opera

  • tiffix
  • Student
  • Student
  • User avatar
  • Posts: 65
  • Loc: kenya

Post 3+ Months Ago

Hello,
i have the following code which only works in opera. help me get it to work with other browsers. thanks
Code: [ Select ]
<script type="text/javascript">
                    function respondToKey(e) {
                    keyPressed = String.fromCharCode(e.which);
                    if(keyPressed == 'g'){
                        window.open('http://localhost/gith/index.htm','mywindow','width=400,height=200');
                    }
                }
        </script>
  1. <script type="text/javascript">
  2.                     function respondToKey(e) {
  3.                     keyPressed = String.fromCharCode(e.which);
  4.                     if(keyPressed == 'g'){
  5.                         window.open('http://localhost/gith/index.htm','mywindow','width=400,height=200');
  6.                     }
  7.                 }
  8.         </script>


Code: [ Select ]
<div id="footerkeywords" onkeypress="respondToKey(event)"></div>
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

It would help if you told us what it's supposed to do and what is happening in other browsers.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8397
  • Loc: USA

Post 3+ Months Ago

I think I can decipher what it's supposed to do... I think he wants to add shortcuts to his site, like when "g" is pressed the user would be sent to this page, and if "h" is pressed then the user would be sent elsewhere... as to how to get that and what is happening in other browsers, I have no idea.
  • tiffix
  • Student
  • Student
  • User avatar
  • Posts: 65
  • Loc: kenya

Post 3+ Months Ago

Bogey is correct. and the pop-up window is open in opera but when i check with other browsers it is not opening. the pop-up window should open when i press 'g' anywhere within the <div id="footerkeywords" onkeypress="respondToKey(event)">Press 'g' to open pop up window...</div>

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 115 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.