# AddKeyMap

Use the AddKeyMap method to map a keyboard key which will cause an action. Learn its syntax and parameters in documentation.

## Content

This method allows you to map a keyboard key which will cause an action.

## Syntax

[JavaScript]

```javascript
FpSpread1.AddKeyMap(keycode,ctrl,shift,alt,action);
```

## Parameters

***keycode***
Integer, key being pressed
***ctrl***
Boolean, Control key
***shift***
Boolean, Shift key
***alt***
Boolean, Alt key
***action***
Constant, CopyLikeExcel, PasteLikeExcel, MoveToPrevCell, MoveToNextCell, MoveToNextRow, MoveToPrevRow, MoveToFirstColumn, MoveToLastColumn, ScrollTo

## Return Type

None

## Remarks

This method allows you to set a JavaScript code action based on a key the user presses. The action can move to the next or previous cell or row, first or last column, or scroll to a cell.

## Example

This is a sample that contains the method. On the client side, the script that contains the method would look like this:

```javascript
<script type="text/javascript">
   function setMap() {
       var ss = document.getElementById("FpSpread1");
       if (ss != null){
          //IE9 or earlier
         //ss.AddKeyMap(13,true,true,false,"this.MoveToLastColumn()");
        ss.AddKeyMap(13,true,true,false,"element.MoveToLastColumn()");
   }
</script>
```

The following code passes a function to the AddKeyMap method. This code works for Microsoft Internet Explorer (IE) and Mozilla Firefox.

```javascript
window.onload = function() {
           var spread1 = document.getElementById("FpSpread1");
           spread1.AddKeyMap(13, false, false, false, function() { var ss = spread1; ss.MoveToLastColumn(); });
       }
```

## See Also

[MoveToPrevRow](/spreadnet/docs/latest/online-asp/overview/spweb-clientscriptref/clientscript-members/clientscript-allmeths/CSSR-MoveToPrevRow)
[ScrollTo](/spreadnet/docs/latest/online-asp/overview/spweb-clientscriptref/clientscript-members/clientscript-allmeths/CSSR-ScrollTo)
[Scripting Members](/spreadnet/docs/latest/online-asp/overview/spweb-clientscriptref/clientscript-members)