locked
disable scrolling with arrow keys RRS feed

  • Question

  • i am developing a web based game with asp.net
    i am using masterpage and content pages

    this is my mater page

    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

    <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >

    < html xmlns = "http://www.w3.org/1999/xhtml" >


    and this is the function i use at my content page


    .
    .
    .
    .
    .



    < script type = "text/javascript" >

    document.onkeyup = KeyCheck;

    function KeyCheck(e)
    {
    var KeyID = (window.event) ? event.keyCode : e.keyCode;

    switch (KeyID) {
    case 37:
    //document.Form1.KeyName.value = "Arrow Left";
    document.getElementById('<%=ImgBtnWest.ClientID%>' ).click();
    break ;

    case 38:
    //document.Form1.KeyName.value = "Arrow Up";
    document.getElementById('<%=ImgBtnNorth.ClientID%>' ).click();
    break ;

    case 39:
    //document.Form1.KeyName.value = "Arrow Right";
    document.getElementById('<%=ImgBtnEast.ClientID%>' ).click();
    break ;

    case 40:
    //document.Form1.KeyName.value = "Arrow Down";
    document.getElementById('<%=ImgBtnSouth.ClientID%>' ).click();
    break ;
    }
    }

    </ script >





    </ asp : Content >


    Browser based Pokemon Style MMORPG Game Developer Used asp.net 4.0 routing at it's Monsters
    Sunday, August 2, 2009 2:44 PM