/ Forside / Teknologi / Udvikling / Java Scripts / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
Java Scripts
#NavnPoint
molokyle 5410
Klaudi 2799
smorch 2439
kim 1360
Harlekin 1134
bentjuul 984
gibson 800
severino 695
Random 675
10  konsulent.. 626
Disable F5
Fra : Simon Holm


Dato : 07-05-01 23:47

Kan man på en eller anden måde disable F5 tasten på tasteturet med
javascript???



 
 
Jakob Andersen (08-05-2001)
Kommentar
Fra : Jakob Andersen


Dato : 08-05-01 00:26

"Simon Holm" <simon_holm@mail.tele.dk> wrote in message
news:9d78kr$1c44$1@news.cybercity.dk...
> Kan man på en eller anden måde disable F5 tasten på tasteturet med
> javascript???

Så vidt jeg husker kan man ikke "fange" (capture) events på FX knapperne.

--
Jakob Andersen
FAQ for webdesign gruppen på
<http://www.usenet.dk/oss/dk.edb.internet.webdesign>
"Det er rart at være vigtig, men det er vigtigere at være rar "



Mads United (08-05-2001)
Kommentar
Fra : Mads United


Dato : 08-05-01 11:02

> Kan man på en eller anden måde disable F5 tasten på tasteturet med
> javascript???

her er måske noget du kan bruge....

----------- kode start -------------


<HTML>
<HEAD>
<TITLE>
Example 3 - Calculator
</TITLE>
<STYLE>
TABLE
{
BACKGROUND: #c0c0c0;
FONT-SIZE: 1em;
}
TD
{
FONT-SIZE: 1em;
FONT-FAMILY: Verdana, Arial, Helvetica;
FONT-WEIGHT: normal;
TEXT-DECORATION: none;
TEXT-ALIGN: center
}
TH
{
FONT-SIZE: 1em;
FONT-FAMILY: Verdana, Arial, Helvetica;
FONT-WEIGHT: bold;
TEXT-DECORATION: none;
TEXT-ALIGN: center
}
..clsDigit
{
BACKGROUND: #ffffff;
COLOR: black;
FONT-FAMILY: Courier;
FONT-WEIGHT: bold;
FONT-SIZE: 1em;
}
..clsOperand
{
BACKGROUND: #c0c0c0;
COLOR: black;
FONT-FAMILY: Courier;
FONT-WEIGHT: bold;
FONT-SIZE: 1em;
}
..clsClear
{
BACKGROUND: #008080;
COLOR: black;
FONT-FAMILY: Courier;
FONT-WEIGHT: bold;
FONT-SIZE: 1em;
}
</STYLE>
</HEAD>
<SCRIPT LANGUAGE="VBSCRIPT">
'Turn on Option Explicit, VB programmer's best friend
Option Explicit

'--------------------------------------------------------
'ASCII codes for keys that matter
Const vbKey0 = &H30
Const vbKey1 = &H31
Const vbKey2 = &H32
Const vbKey3 = &H33
Const vbKey4 = &H34
Const vbKey5 = &H35
Const vbKey6 = &H36
Const vbKey7 = &H37
Const vbKey8 = &H38
Const vbKey9 = &H39

Const vbKeyNumpad0 = &H30
Const vbKeyNumpad1 = &H31
Const vbKeyNumpad2 = &H32
Const vbKeyNumpad3 = &H33
Const vbKeyNumpad4 = &H34
Const vbKeyNumpad5 = &H35
Const vbKeyNumpad6 = &H36
Const vbKeyNumpad7 = &H37
Const vbKeyNumpad8 = &H38
Const vbKeyNumpad9 = &H39

Const vbKeyDecimalGeneral = &H2E
Const vbKeyMultiplyGeneral = &H2A
Const vbKeyDivideGeneral = &H2F
Const vbKeySubtractGeneral = &H2D
Const vbKeyAddGeneral = &H2B

Const vbKeyDecimalNumLock = &H6E
Const vbKeyMultiplyNumLock = &H6A
Const vbKeyDivideNumLock = &H6F
Const vbKeySubtractNumLock = &H6D
Const vbKeyAddNumLock =&H6B

Const vbKeyF9 = &H78
Const vbKeyEscape = &H1B
Const vbKeyC = &H43
Const vbKeyCSmall = &H63
Const vbKeyE = &H45
Const vbKeyESmall = &H65

Const vbKeyEqual = &H3D
Const vbKeyEnter = &HD

'--------------------------------------------------------
'Types of operations that could be performed
Const calcOperandNone = 0
Const calcOperandMultiply = 1
Const calcOperandDivide = 2
Const calcOperandSubtract = 3
Const calcOperandAdd = 4

'Current calculator state
Const calcStateUnknown = 0
Const calcStateTypingFirstNumber = 1
Const calcStateTypingOperand = 2
Const calcStateTypingSecondNumber = 3
Const calcStatePerformedOperation = 4

Dim mCurrentState 'as one of the calcState constants
Dim mcurrPreviousValue 'as Currency Variant
Dim mcurrCurrentValue 'as Currency Variant
Dim mCurrentOperand 'one of the calcOperand constants
Dim mbPeriodPressed 'whether Decimal period has been pressed
Dim mlNumberOfDecimalPlaces 'how many decimal places we have in this number

'--------------------------------------------------------
'this is page-wide keypress processing function
Function ProcessKeyPress()
Dim s
Dim lKeyCode

On Error Resume Next

lKeyCode = window.event.keyCode

txtKeyCodeKeyPress.value = lKeyCode
txtHexKeyCodeKeyPress.value = "&H" & Hex(lKeyCode)
txtCtrlKeyPress.value = window.event.ctrlKey
txtAltKeyPress.value = window.event.altKey
txtShiftKeyPress.value = window.event.shiftKey
s = LCase(window.event.srcElement.tagName)
txtTagNameKeyPress.value = s
s = window.event.srcElement.id
If Not Err.Number = 0 Then
'Element has no ID
Err.Clear
s = ""
End If
txtIDKeyPress.value = s

If Not IsKeyPressInsideCalculator() Then
'KeyUp event did not originate from inside of divCalculator DIV,
exit handler
Exit Function
End If

Select Case lKeyCode
Case vbKey0, vbKeyNumpad0
Call Press_0()
Case vbKey1, vbKeyNumpad1
Call Press_1()
Case vbKey2, vbKeyNumpad2
Call Press_2()
Case vbKey3, vbKeyNumpad3
Call Press_3()
Case vbKey4, vbKeyNumpad4
Call Press_4()
Case vbKey5, vbKeyNumpad5
Call Press_5()
Case vbKey6, vbKeyNumpad6
Call Press_6()
Case vbKey7, vbKeyNumpad7
Call Press_7()
Case vbKey8, vbKeyNumpad8
Call Press_8()
Case vbKey9, vbKeyNumpad9
Call Press_9()
Case vbKeyDecimalGeneral, vbKeyDecimalNumLock
Call Press_Period
Case vbKeyDivideGeneral, vbKeyDivideNumLock
Call Press_Divide()
Case vbKeyMultiplyNumLock, vbKeyMultiplyGeneral
Call Press_Multiply()
Case vbKeySubtractGeneral, vbKeySubtractNumLock
Call Press_Subtract()
Case vbKeyAddGeneral, vbKeyAddNumLock
Call Press_Add()
Case vbKeyF9
Call Press_F9()
Case vbKeyEscape
Call Press_Escape()
Case vbKeyC, vbKeyCSmall
Call Press_Clear()
Case vbKeyE, vbKeyESmall
Call Press_ClearError()
Case vbKeyEqual, vbKeyEnter
Call Press_Equal()
Case Else
'Do nothing
window.event.returnValue = Nothing
End Select

End Function
'--------------------------------------------------------


'--------------------------------------------------------
'this is page-wide keyup processing function
Function ProcessKeyUp()
Dim s
Dim lKeyCode

On Error Resume Next

lKeyCode = window.event.keyCode

txtKeyCodeKeyUp.value = lKeyCode
txtHexKeyCodeKeyUp.value = "&H" & Hex(lKeyCode)
txtCtrlKeyUp.value = window.event.ctrlKey
txtAltKeyUp.value = window.event.altKey
txtShiftKeyUp.value = window.event.shiftKey
s = LCase(window.event.srcElement.tagName)
txtTagNameKeyUp.value = s
s = window.event.srcElement.id
If Not Err.Number = 0 Then
'Element has no ID
Err.Clear
s = ""
End If
txtIDKeyUp.value = s

If Not IsKeyPressInsideCalculator() Then
'KeyUp event did not originate from inside of divCalculator DIV,
exit handler
Exit Function
End If

Select Case lKeyCode
Case vbKeyF9
Call Press_ChangeSign()
Case Else
'Do nothing
window.event.returnValue = Nothing
End Select

End Function
'--------------------------------------------------------


'--------------------------------------------------------
'this is page-wide keydown processing function
Function ProcessKeyDown()
Dim s
Dim lKeyCode

On Error Resume Next

lKeyCode = window.event.keyCode

txtKeyCodeKeyDown.value = lKeyCode
txtHexKeyCodeKeyDown.value = "&H" & Hex(lKeyCode)
txtCtrlKeyDown.value = window.event.ctrlKey
txtAltKeyDown.value = window.event.altKey
txtShiftKeyDown.value = window.event.shiftKey
s = LCase(window.event.srcElement.tagName)
txtTagNameKeyDown.value = s
s = window.event.srcElement.id
If Not Err.Number = 0 Then
'Element has no ID
Err.Clear
s = ""
End If
txtIDKeyDown.value = s

If Not IsKeyPressInsideCalculator() Then
'KeyDown event did not originate from inside of divCalculator DIV,
exit handler
Exit Function
End If

Select Case lKeyCode
Case Else
'Do nothing
End Select

End Function
'--------------------------------------------------------


'--------------------------------------------------------
'this function checks whether buttons have been pressed inside divCalculator
DIV
'it returns True if that is the case, false otherwise
Function IsKeyPressInsideCalculator()
Dim bInsideCalculator
Dim objElement
Dim sObjID

On Error Resume Next

'Check whether we are getting keypresses from inside of divCalculator
DIV
bInsideCalculator = False
sObjID = ""
Set objElement = window.event.srcElement
Do
sObjID = objElement.id
If Not Err.Number = 0 Then
'Element has no ID
Err.Clear
sObjID = ""
End If
'MsgBox objElement.tagName & " " & sObjID
If sObjID = "divCalculator" Then
'We found calculator DIV
bInsideCalculator = True
'Exit loop
Exit Do
Else
'Set objElement to it's parent
Set objElement = objElement.parentElement
'Did we hit the top of hierarchy?
If IsEmpty(objElement) Then
Exit Do
ElseIf objElement Is Nothing Then
Exit Do
ElseIf Not Err.Number = 0 Then
Err.Clear
Exit Do
End If
End If
Loop

'Clean up
Set objElement = Nothing

'Return value
IsKeyPressInsideCalculator = bInsideCalculator

End Function
'--------------------------------------------------------


'--------------------------------------------------------
Sub Window_OnLoad()
txtCurrentValue.focus

LetCurrentValue 0
LetPreviousValue 0
mCurrentOperand = calcOperandNone
mbPeriodPressed = False
mlNumberOfDecimalPlaces = 0
mCurrentState = calcStateTypingFirstNumber

End Sub
'--------------------------------------------------------

'--------------------------------------------------------
Sub Press_0()
cmdDigit0.focus
AddToCurrentValue 0
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_1()
cmdDigit1.focus
AddToCurrentValue 1
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_2()
cmdDigit2.focus
AddToCurrentValue 2
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_3()
cmdDigit3.focus
AddToCurrentValue 3
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_4()
cmdDigit4.focus
AddToCurrentValue 4
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_5()
cmdDigit5.focus
AddToCurrentValue 5
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_6()
cmdDigit6.focus
AddToCurrentValue 6
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_7()
cmdDigit7.focus
AddToCurrentValue 7
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_8()
cmdDigit8.focus
AddToCurrentValue 8
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_9()
cmdDigit9.focus
AddToCurrentValue 9
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_Period()
cmdPeriod.focus
If mbPeriodPressed = False Then
mbPeriodPressed = True
mlNumberOfDecimalPlaces = 1
End If
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_Divide()
cmdDivide.focus
LetCurrentOperand calcOperandDivide
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_Multiply()
cmdMultiply.focus
LetCurrentOperand calcOperandMultiply
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_Subtract()
cmdSubtract.focus
LetCurrentOperand calcOperandSubtract
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_Add()
cmdAdd.focus
LetCurrentOperand calcOperandAdd
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_ChangeSign()
cmdChangeSign.focus
LetCurrentValue GetCurrentValue * (-1)
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_Escape()
cmdClearError.focus
LetCurrentValue 0
mbPeriodPressed = False
mlNumberOfDecimalPlaces = 0
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_Clear()
cmdClear.focus
LetCurrentValue 0
LetPreviousValue 0
mCurrentOperand = calcOperandNone
mbPeriodPressed = False
mlNumberOfDecimalPlaces = 0
mCurrentState = calcStateTypingFirstNumber
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_ClearError()
cmdClearError.focus
LetCurrentValue 0
mbPeriodPressed = False
mlNumberOfDecimalPlaces = 0
End Sub
'--------------------------------------------------------
'--------------------------------------------------------
Sub Press_Equal()
cmdEqual.focus
PerformCalculations
End Sub
'--------------------------------------------------------

'--------------------------------------------------------
Function LetCurrentValue(currValue)
mcurrCurrentValue = currValue
txtCurrentValue.value = CStr(mcurrCurrentValue)
End Function
'--------------------------------------------------------
'--------------------------------------------------------
Function GetCurrentValue()
GetCurrentValue = mcurrCurrentValue
End Function
'--------------------------------------------------------
'--------------------------------------------------------
Function LetPreviousValue(currValue)
mcurrPreviousValue = currValue
End Function
'--------------------------------------------------------
'--------------------------------------------------------
Function GetPreviousValue()
GetPreviousValue = mcurrPreviousValue
End Function
'--------------------------------------------------------
'--------------------------------------------------------
Function LetCurrentOperand(Operand)
If mCurrentState = calcStateTypingFirstNumber Or mCurrentState =
calcStatePerformedOperation Then
'Now reshuffle values in memory
LetPreviousValue GetCurrentValue
LetCurrentValue 0
mbPeriodPressed = False
mlNumberOfDecimalPlaces = 0
mCurrentState = calcStateTypingOperand
ElseIf mCurrentState = calcStateTypingOperand Then
'Do nothing, just accept change in operand
ElseIf mCurrentState = calcStateTypingSecondNumber Then
'Perform calculations first, then proceed with operand change
PerformCalculations
'Now calculated number is first value, state is choosing what to do
with it
mCurrentState = calcStateTypingOperand
End If
mCurrentOperand = Operand

End Function
'--------------------------------------------------------
'--------------------------------------------------------
Function GetCurrentOperand()
GetCurrentOperand = mCurrentOperand
End Function
'--------------------------------------------------------

'--------------------------------------------------------
Sub AddToCurrentValue(iDigit)
'msgbox iDigit
If mCurrentState = calcStatePerformedOperation Then
'Reset display
LetCurrentValue 0
ElseIf mCurrentState = calcStateTypingOperand Then
'move to typing the second number
mCurrentState = calcStateTypingSecondNumber
End If

If mbPeriodPressed Then
'working on decimal part of number
If GetCurrentValue => 0 Then
LetCurrentValue GetCurrentValue + iDigit / (10 ^
mlNumberOfDecimalPlaces)
Else
LetCurrentValue GetCurrentValue - iDigit / (10 ^
mlNumberOfDecimalPlaces)
End If
mlNumberOfDecimalPlaces = mlNumberOfDecimalPlaces + 1
Else
'working on whole part of the number
If GetCurrentValue => 0 Then
LetCurrentValue GetCurrentValue * 10 + iDigit
Else
LetCurrentValue GetCurrentValue * 10 - iDigit
End If
End If
End Sub
'--------------------------------------------------------

'--------------------------------------------------------
Sub PerformCalculations()

On Error Resume Next

Select Case mCurrentOperand
Case calcOperandMultiply
LetCurrentValue GetPreviousValue * GetCurrentValue
Case calcOperandDivide
LetCurrentValue GetPreviousValue / GetCurrentValue
Case calcOperandSubtract
LetCurrentValue GetPreviousValue - GetCurrentValue
Case calcOperandAdd
LetCurrentValue GetPreviousValue + GetCurrentValue
Case Else
'Do nothing
'MsgBox "Huh?", vbInformation, "Calculator"
End Select

If Not Err.Number = 0 Then
'Error during calculations
MsgBox "Error during calculations: " & Err.Number & " (" &
Err.Description & ")", vbInformation, "Calculator"
Err.Clear
LetCurrentValue 0
LetPreviousValue 0
End If

'Reset operand
mCurrentOperand = calcOperandNone
'Reset decimal place variables
mbPeriodPressed = False
mlNumberOfDecimalPlaces = 0
'Reset calculator state
mCurrentState = calcStatePerformedOperation

End Sub
'--------------------------------------------------------

</SCRIPT>
<BODY ONKEYPRESS="ProcessKeyPress()" ONKEYUP="ProcessKeyUp()"
ONKEYDOWN="ProcessKeyDown()">
<!--TOOLBAR_START-->
<!--TOOLBAR_EXEMPT-->
<!--TOOLBAR_END-->
Example 3 - Calculator<BR>
(View source for code)
<P>
<DIV ID="divCalculator" NAME="divCalculator" STYLE="visibility:visible;">
<TABLE BORDER="1" TABINDEX="10" ID="tblCalculator" ACCESSKEY="t">
<THEAD>
<TR>
<TH COLSPAN="4">
<LABEL FOR="txtCurrentValue">C<U>a</U>lculator</LABEL>
</TH>
</TR>
</THEAD>
<TBODY>
<TR>
<TD COLSPAN="4">
<INPUT TYPE="text" ID="txtCurrentValue"
NAME="txtCurrentValue" ACCESSKEY="a" TITLE="Calculations window" DIR="LTR">
</TD>
</TR>
<TR>
<TD>
<INPUT TYPE="BUTTON" ID="cmdDigit7" NAME="cmdDigit7" VALUE="
7 " CLASS="clsDigit" ACCESSKEY="7" TITLE="7" ONCLICK="Press_7()">
</TD>
<TD>
<INPUT TYPE="BUTTON" ID="cmdDigit8" NAME="cmdDigit8" VALUE="
8 " CLASS="clsDigit" ACCESSKEY="8" TITLE="8" ONCLICK="Press_8()">
</TD>
<TD>
<INPUT TYPE="BUTTON" ID="cmdDigit9" NAME="cmdDigit9" VALUE="
9 " CLASS="clsDigit" ACCESSKEY="9" TITLE="9" ONCLICK="Press_9()">
</TD>
<TD>
<INPUT TYPE="BUTTON" ID="cmdDivide" NAME="cmdDivide" VALUE="
/ " CLASS="clsOperand" ACCESSKEY="/" TITLE="Divide by"
ONCLICK="Press_Divide">
</TD>
</TR>
<TR>
<TD>
<INPUT TYPE="BUTTON" ID="cmdDigit4" NAME="cmdDigit4" VALUE="
4 " CLASS="clsDigit" ACCESSKEY="4" TITLE="4" ONCLICK="Press_4()">
</TD>
<TD>
<INPUT TYPE="BUTTON" ID="cmdDigit5" NAME="cmdDigit5" VALUE="
5 " CLASS="clsDigit" ACCESSKEY="5" TITLE="5" ONCLICK="Press_5()">
</TD>
<TD>
<INPUT TYPE="BUTTON" ID="cmdDigit6" NAME="cmdDigit6" VALUE="
6 " CLASS="clsDigit" ACCESSKEY="6" TITLE="6" ONCLICK="Press_6()">
</TD>
<TD>
<INPUT TYPE="BUTTON" ID="cmdMultiply" NAME="cmdMultiply"
VALUE=" * " CLASS="clsOperand" ACCESSKEY="*" TITLE="Multiply by"
ONCLICK="Press_Multiply">
</TD>
</TR>
<TR>
<TD>
<INPUT TYPE="BUTTON" ID="cmdDigit1" NAME="cmdDigit1" VALUE="
1 " CLASS="clsDigit" ACCESSKEY="1" TITLE="1" ONCLICK="Press_1()">
</TD>
<TD>
<INPUT TYPE="BUTTON" ID="cmdDigit2" NAME="cmdDigit2" VALUE="
2 " CLASS="clsDigit" ACCESSKEY="2" TITLE="2" ONCLICK="Press_2()">
</TD>
<TD>
<INPUT TYPE="BUTTON" ID="cmdDigit3" NAME="cmdDigit" VALUE="
3 " CLASS="clsDigit" ACCESSKEY="3" TITLE="3" ONCLICK="Press_3()">
</TD>
<TD>
<INPUT TYPE="BUTTON" ID="cmdSubtract" NAME="cmdSubtract"
VALUE=" - " CLASS="clsOperand" ACCESSKEY="-" TITLE="Subtract"
ONCLICK="Press_Subtract">
</TD>
</TR>
<TR>
<TD>
<INPUT TYPE="BUTTON" ID="cmdDigit0" NAME="cmdDigit0" VALUE="
0 " CLASS="clsDigit" ACCESSKEY="0" TITLE="0" ONCLICK="Press_0()">
</TD>
<TD>
<INPUT TYPE="BUTTON" ID="cmdPeriod" NAME="cmdPeriod" VALUE="
.. " CLASS="clsDigit" ACCESSKEY="." TITLE="Decimal period"
ONCLICK="Press_Period()">
</TD>
<TD>
<INPUT TYPE="BUTTON" ID="cmdChangeSign" NAME="cmdChangeSign"
VALUE="+/-" CLASS="clsOperand" ACCESSKEY="" TITLE="Change sign (F9)"
ONCLICK="Press_ChangeSign()">
</TD>
<TD>
<INPUT TYPE="BUTTON" ID="cmdAdd" NAME="cmdAdd" VALUE=" + "
CLASS="clsOperand" ACCESSKEY="+" TITLE="Add" ONCLICK="Press_Add">
</TD>
</TR>
<TR>
<TD>
<INPUT TYPE="BUTTON" ID="cmdClear" NAME="cmdClear" VALUE=" C
" CLASS="clsClear" ACCESSKEY="a" TITLE="Clear all calculations"
ONCLICK="Press_Clear()">
</TD>
<TD>
<INPUT TYPE="BUTTON" ID="cmdClearError" NAME="cmdClearError"
VALUE=" E " CLASS="clsClear" ACCESSKEY="Es" TITLE="Clear number on the
screen, leaving operand in memory" ONCLICK="Press_ClearError()">
</TD>
<TD COLSPAN="2">
<INPUT TYPE="BUTTON" ID="cmdEqual" NAME="cmdEqual" VALUE="
= " CLASS="clsOperand" ACCESSKEY="=" TITLE="Equals"
ONCLICK="Press_Equal()">
</TD>
</TR>
</TBODY>
</TABLE>
</DIV>

<P>

KeyPress, KeyDown and KeyUp event return values:
<TABLE BORDER="1">
<TR>
<TD>Event</TD>
<TD>KeyCode</TD>
<TD>Hex KeyCode</TD>
<TD>Ctrl</TD>
<TD>Alt</TD>
<TD>Shift</TD>
<TD>Element TagName</TD>
<TD>Element ID</TD>
</TR>
<TR>
<TD>KeyPress</TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtKeyCodeKeyPress"></TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtHexKeyCodeKeyPress"></TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtCtrlKeyPress"></TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtAltKeyPress"></TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtShiftKeyPress"></TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtTagNameKeyPress"></TD>
<TD><INPUT TYPE="text" SIZE="20" ID="txtIDKeyPress"></TD>
</TR>
<TR>
<TD>KeyUp</TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtKeyCodeKeyUp"></TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtHexKeyCodeKeyUp"></TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtCtrlKeyUp"></TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtAltKeyUp"></TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtShiftKeyUp"></TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtTagNameKeyUp"></TD>
<TD><INPUT TYPE="text" SIZE="20" ID="txtIDKeyUp"></TD>
</TR>
<TR>
<TD>KeyDown</TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtKeyCodeKeyDown"></TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtHexKeyCodeKeyDown"></TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtCtrlKeyDown"></TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtAltKeyDown"></TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtShiftKeyDown"></TD>
<TD><INPUT TYPE="text" SIZE="4" ID="txtTagNameKeyDown"></TD>
<TD><INPUT TYPE="text" SIZE="20" ID="txtIDKeyDown"></TD>
</TR>
</TABLE>
</BODY>
</HTML>


----- kode slut --------



Jakob Andersen (08-05-2001)
Kommentar
Fra : Jakob Andersen


Dato : 08-05-01 17:08

"Mads United" <mmm@graffiti.net> wrote in message
news:9d8g54$2e8$1@sunsite.dk...
> her er måske noget du kan bruge....
[Snip kode]

hrmh.... Ligner det javascript?

--
Jakob Andersen
"No matter how great and destructive your problems may seem now, remember,
you´ve probably only seen the tip of them."



Lars Hoffmann (08-05-2001)
Kommentar
Fra : Lars Hoffmann


Dato : 08-05-01 21:09

Jakob Andersen wrote:
>
> "Mads United" <mmm@graffiti.net> wrote in message
> news:9d8g54$2e8$1@sunsite.dk...
> > her er måske noget du kan bruge....
> [Snip kode]
>
> hrmh.... Ligner det javascript?

næh, men til gengæld vil det kunne bruges til formålet, da F5 også er en
IE ting ligesom VBscript.
--
/Lars

HTML software: <http://go.to/HTMLEasyColors>
Brug venligst Re: og ikke Sv: ved svar, da beskeder
der begynder med Sv: bliver slettet fra mange servere

Jakob Andersen (08-05-2001)
Kommentar
Fra : Jakob Andersen


Dato : 08-05-01 21:23

"Lars Hoffmann" <lars@hoffmann.ac> wrote in message
news:3AF8525D.6581D834@hoffmann.ac...
> næh, men til gengæld vil det kunne bruges til formålet, da F5 også er en
> IE ting ligesom VBscript.

I NN6 kan man da også bruge F5 til Refresh eller er det bare mig der husker
forkert?

--
Jakob Andersen
FAQ for webdesign gruppen på
<http://www.usenet.dk/oss/dk.edb.internet.webdesign>
"Det er rart at være vigtig, men det er vigtigere at være rar "



Michael Legart (08-05-2001)
Kommentar
Fra : Michael Legart


Dato : 08-05-01 21:44

On Tue, 8 May 2001 22:22:48 +0200, Jakob Andersen <jakob@andersen.as> wrote:
>
> I NN6 kan man da også bruge F5 til Refresh eller er det bare mig der husker
> forkert?

Det er vist dig, der husker forkert. I Mozilla 0.8.1 skal man i hvert fald
bruge ctrl-r - og F5 goer ikke noget.

--
package Disclamer;

BEGIN { print "Arbejder hos World Online, men taler for mig selv"; }
1;

Jakob Andersen (08-05-2001)
Kommentar
Fra : Jakob Andersen


Dato : 08-05-01 22:44

"Michael Legart" <legart@daarligstil.dk> wrote in message
news:slrn9fgmkd.qkd.legart@dustpuppy.worldonline.dk...
> Det er vist dig, der husker forkert. I Mozilla 0.8.1 skal man i hvert fald
> bruge ctrl-r - og F5 goer ikke noget.

Testede lige: i min Netscape 6,01 refresher F5.

--
Jakob Andersen
FAQ for webdesign gruppen på
<http://www.usenet.dk/oss/dk.edb.internet.webdesign>
"Det er rart at være vigtig, men det er vigtigere at være rar "



Dennis Skærup Højlun~ (08-05-2001)
Kommentar
Fra : Dennis Skærup Højlun~


Dato : 08-05-01 22:48

Michael Legart wrote:

>Det er vist dig, der husker forkert. I Mozilla 0.8.1 skal man i hvert fald
>bruge ctrl-r - og F5 goer ikke noget.

Windåse-udgaven refresher nu når man klamper <F5> i bund.

--
Dennis Skærup Højlund Andersen (http://dennisandersen.dk)

:: Lejlighed i Århus søges!! ::
:: http://dennisandersen.dk/lejlighed/ ::

Simon Holm (08-05-2001)
Kommentar
Fra : Simon Holm


Dato : 08-05-01 17:29

Jeg har selv fundet ud af det.
Denne kode

<script>
function FjernF5(){
with (event){
if (keyCode==116 || (ctrlKey && keyCode==82)){
// F5 eller Ctrl+R
event.keyCode = 0;
event.cancelBubble = true;
return false;
}
}
}

document.onkeydown = FjernF5;
</script>

Disabler F5 og Crtl + R

Ellers tak for hjælpen
"Simon Holm" <simon_holm@mail.tele.dk> skrev i en meddelelse
news:9d78kr$1c44$1@news.cybercity.dk...
> Kan man på en eller anden måde disable F5 tasten på tasteturet med
> javascript???
>
>



Søg
Reklame
Statistik
Spørgsmål : 177559
Tips : 31968
Nyheder : 719565
Indlæg : 6408935
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste