www.webdeveloper.com
Results 1 to 2 of 2

Thread: Need div + hotkey help

  1. #1
    Join Date
    Feb 2009
    Posts
    8

    Need div + hotkey help

    hi all, i would like to ask for help on div/layer for my webpage.
    this is my code
    Code:
    <html>
    
    <HEAD><TITLE>Handling Keyboard Shortcuts in JavaScript</TITLE>
    
    <script language="JavaScript1.2">
    
    
    if (document.layers)
    document.captureEvents(Event.KEYPRESS)
    function backhome(e){
    var targeturl="digital-alarm-clock(edit).swf"
    if (document.layers||document.getElementById&&!document.all){
    if (e.which==104||e.which==72)
    window.location=targeturl
    }
    else if (document.all){
    if (event.keyCode==104||event.keyCode==72)
    window.location=targeturl
    }
    }
    document.onkeypress=backhome
    //-->
    </script>
    
    </head>
    <body>
        dd
    </body>
    </html>
    however from this code , the way the alarm is displayed is not what we wnated,after H key is press,the alarm will come out over-lapping the orginal webpage, but what we wanted is to let it silde in horizontally using a div/layer method in the same html page.

    would hope there there is any kind soul who can help me with this troublesome code T_T

  2. #2
    Join Date
    Mar 2007
    Location
    USA
    Posts
    449
    You could assign some CSS to a targeted div holding the alarm. You just have to set it's z-index higher than the page below it and it will move independently.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles