Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 11

Discussione: Funzioni Onkeydown

  1. #1

    Funzioni Onkeydown

    Ciao ha tutti, ho un problema con uno script vb e visto che sono alle prime armi vi chiedo aiuto.
    si tratta di uno script che serve per ottenere l'effetto zoom su una immagine. Per come e' scritto funziona con i click del mouse. Io vorrei invece che funzionasse con due tasti della tastiera. Mi potete consigliare qualcosa? Vi incollo qua' lo script
    <SCRIPT LANGUAGE="VBSCRIPT">
    <!--

    Dim DotL(24)

    Dim DotT(24)

    Dim MapWidth, MapHeight, MapLeft, MapTop

    Dim i, Zebbie, framex, framez



    MapWidth = 750

    MapHeight = 598



    i = 1

    Zebbie = 1


    Sub HideMap()

    If i < 1000 then

    MapWidth = MapWidth + 200

    MapHeight = MapHeight + 200


    ZooMap.style.width = MapWidth

    ZooMap.style.height = MapHeight

    ZooMap.style.left = MapLeft - 0

    ZooMap.style.top = MapTop - 0

    i = i + 1



    Else

    ZooMap.style.width = 750

    ZooMap.style.height =598

    MapWidth = 420

    MapHeight = 340

    MapLeft = 123

    MapTop = 151

    i = 1



    End If

    End Sub

    Sub ShowMap()

    If i < 1000 then

    MapWidth = MapWidth - 150

    MapHeight = MapHeight - 150

    ZooMap.style.width = MapWidth

    ZooMap.style.height = MapHeight

    ZooMap.style.left = MapLeft - 0

    ZooMap.style.top = MapTop - 0

    i = i + 1



    Else

    ZooMap.style.width = 750
    ZooMap.style.height = 598
    MapWidth = 420

    MapHeight = 340

    MapLeft = -0

    MapTop = -0
    i = 1



    End If

    End Sub

    -->

    </SCRIPT>
    <BODY bgcolor="white">
    <DIV style="position:relative; width:420; height:340; align="center">
    [img]C:/mappe/PA_c.GIF[/img]


    Come vedete il tutto e' gestito da Onclick e Oncontextmenu

  2. #2
    ONKEYDOWN.... (vbs)

    If Window.Event.KeyKode = <tasto> Then
    ShowMap
    Else If Window.Event.KeyKode = <tasto> Then
    HideMap
    End If
    DYNAMIC+ [ E-mail ]

    Secondo me non si può fare!

  3. #3
    Ti ringrazio ma ho ancora problemi, legati per lo piu' alla mia ignoranza, i tasti devo iserirli direttamnete (tipo <+> e <->) o bisogna mettere il codice trap del tasto?
    Altra cosa, esattamente dove devo inserirlo? Per ora ho fatto cosi' ma non funziona :
    End If

    End Sub

    Sub Key()

    If
    Window.Event.KeyKode = <+>
    Then ShowMap()
    Else If
    Window.Event.KeyKode = <->
    Then HideMap()
    End If
    End Sub

    -->
    </SCRIPT>
    <BODY bgcolor="white">
    <DIV style="position:relative; width:; height:; align="center">
    [img]C:/mappe/PA_c.GIF[/img]

  4. #4
    <+>

    e

    <->


    lo devi sostituire coi codice dei tasti
    13 per esempio è INVIO
    DYNAMIC+ [ E-mail ]

    Secondo me non si può fare!

  5. #5
    Ho provato cosi' ma non va ancora, qualche altro consiglio?

    End Sub

    If
    Window.Event.KeyKode = 13
    Then ShowMap()
    Else If
    Window.Event.KeyKode = 189
    Then HideMap()
    End If
    -->
    </SCRIPT>
    <BODY bgcolor="white">
    <DIV style="position:relative"; width:; height:; align="center">
    [img]C:/mappe/PA_c.GIF[/img]
    </DIV>
    </body>
    </html>

  6. #6
    <SCRIPT LANGUAGE="VBSCRIPT">
    <!--

    Dim DotL(24)

    Dim DotT(24)

    Dim MapWidth, MapHeight, MapLeft, MapTop

    Dim i, Zebbie, framex, framez



    MapWidth = 750

    MapHeight = 598



    i = 1

    Zebbie = 1


    Sub HideMap()

    If i < 1000 then

    MapWidth = MapWidth + 200

    MapHeight = MapHeight + 200


    ZooMap.style.width = MapWidth

    ZooMap.style.height = MapHeight

    ZooMap.style.left = MapLeft - 0

    ZooMap.style.top = MapTop - 0

    i = i + 1



    Else

    ZooMap.style.width = 750

    ZooMap.style.height =598

    MapWidth = 420

    MapHeight = 340

    MapLeft = 123

    MapTop = 151

    i = 1



    End If

    End Sub

    Sub ShowMap()

    If i < 1000 then

    MapWidth = MapWidth - 150

    MapHeight = MapHeight - 150

    ZooMap.style.width = MapWidth

    ZooMap.style.height = MapHeight

    ZooMap.style.left = MapLeft - 0

    ZooMap.style.top = MapTop - 0

    i = i + 1



    Else

    ZooMap.style.width = 750
    ZooMap.style.height = 598
    MapWidth = 420

    MapHeight = 340

    MapLeft = -0

    MapTop = -0
    i = 1



    End If

    End Sub


    Sub GestioneEvento()

    If Window.Event.KeyCode = 37 Then
    ShowMap
    ElseIf Window.Event.KeyCode = 39 Then
    HideMap
    End If

    End Sub

    -->

    </SCRIPT>
    <BODY bgcolor="white" OnKeyDown="GestioneEvento()">
    <DIV style="position:relative; width:420; height:340; align="center">
    [img]C:/mappe/PA_c.GIF[/img]






    freccia DESTRA e SINISTRA.
    DYNAMIC+ [ E-mail ]

    Secondo me non si può fare!

  7. #7
    GRAZIEEEEEEE!!! Tu non hai idea di quanto tempo io sia dietro a questo script!
    Ora funziona a meraviglia

  8. #8
    Originariamente inviato da egineg
    GRAZIEEEEEEE!!! Tu non hai idea di quanto tempo io sia dietro a questo script!
    Ora funziona a meraviglia

    se fossi in te lo rifarei in JAvaSCript
    tutto dipende da ki o dove andra' usato!

    VBs è SOLO x IE (e alcune versioni di NS con plugin)
    DYNAMIC+ [ E-mail ]

    Secondo me non si può fare!

  9. #9
    lo devo usare dentro un'utility di Flight simulator, in javascript non lo so fare. Ma cosi' va bene direi

  10. #10
    Originariamente inviato da egineg
    lo devo usare dentro un'utility di Flight simulator, in javascript non lo so fare. Ma cosi' va bene direi

    xfetto. buonanotte - scappo.
    sono connesso da + di 16ore...
    DYNAMIC+ [ E-mail ]

    Secondo me non si può fare!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.