Hi Nikos,
Thank you for your suggestion. Being weak in JavaScript I'm wondering
what I'd write to replace "do whatever javascript you want" in your code
to return tab instead to of Enter to a browser. Can I ask you to help me
here too?
Best regards
Janko
paranic wrote:
> try this
> i have made an accountant application for entering CashFlow data
> table navigation with arrow keys and many more
>
> document.onkeypress = manageCashflowCellNavigation;
> ev=window.event;
> function manageCashflowCellNavigation(ev)
> {
> if (!ev) var ev = window.event
> if (ev.keyCode) code = ev.keyCode;
> else if (ev.which) code = ev.which;
>
> // alert('You Pressed ' + code);
>
> switch (code)
> {
> case 40: // down arrow
> // do whatever javascript you whant
> break
> case 38: // up arrow
> // do whatever javascript you whant
> break
> case 37: // left arrow
> // do whatever javascript you whant
> break
> case 39: // right arrow
> // do whatever javascript you whant
> break
> case 97: // a
> case 97: // b
> case 99: // c
> case 100: // d
> case 101: // e
> case 102: // f
> case 103: // g
> case 104: // h
> case 105: // i
> case 106: // j
> case 107: // k
> case 108: // l
> case 109: // m
> case 110: // n
> case 111: // o
> case 112: // p
> case 113: // q
> case 114: // r
> case 115: // s
> //case 116: // t F5
> case 117: // u
> case 118: // v
> case 119: // w
> case 120: // x
> case 121: // y
> case 122: // z
> case 945: // α
> case 946: // β
> case 947: // γ
> case 948: // δ
> case 949: // ε
> case 950: // ζ
> case 951: // η
> case 952: // θ
> case 953: // ι
> case 954: // κ
> case 955: // λ
> case 956: // μ
> case 957: // ν
> case 958: // ξ
> case 959: // ο
> case 960: // π
> case 961: // ρ
> case 962: // ς
> case 963: // σ
> case 964: // τ
> case 965: // υ
> case 966: // φ
> case 967: // χ
> case 968: // ψ
> case 969: // ω
> // do whatever javascript you whant
> return;
> break
> case 13: // ender key
> // do whatever javascript you whant
> return;
> case 27: // espcape
> // do whatever javascript you whant
> break
> default:
> // do whatever javascript you whant
> //return false;
> }
> }
>
> i am doing varius things there in each case
> navigation
> if you press numeric you add value
> if you press character you add description
> just like excel
>
>
> Nikos
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---