Reply
Help Needed: Multiple Script
Old 01-24-2008, 11:33 AM Help Needed: Multiple Script
Finney's Avatar
Skilled Talker

Posts: 91
Name: El Finney
Location: England, UK
I have a script that was helped peice together.. I am no too good at Javascript but I understand alot more with knowledge of PHP etc. I have some code which I will provide below and I have gathered that it needs closing off all variables to start the new script because when I use the script file only the last script works.. It consitsts of 4 different actions being used. I am asking if somebody could help me render and fix the script.



All future thanks for help given..



Code:
var hotkey=119
var destination="up.php"
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function actionup(e){
if (document.layers){
if (e.which==hotkey)
window.location=destination
}
else if (document.all){
if (event.keyCode==hotkey)
window.location=destination
}
}
document.onkeypress=actionup
 
var hotkey=115
var destination="down.php"
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function actiondown(e){
if (document.layers){
if (e.which==hotkey)
window.location=destination
}
else if (document.all){
if (event.keyCode==hotkey)
window.location=destination
}
}
document.onkeypress=actiondown
 
var hotkey=113
var destination="left.php"
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function actionleft(e){
if (document.layers){
if (e.which==hotkey)
window.location=destination
}
else if (document.all){
if (event.keyCode==hotkey)
window.location=destination
}
}
document.onkeypress=actionleft
 
var hotkey=097
var destination="right.php"
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function actionright(e){
if (document.layers){
if (e.which==hotkey)
window.location=destination
}
else if (document.all){
if (event.keyCode==hotkey)
window.location=destination
}
}
document.onkeypress=actionright
Finney is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 01-24-2008, 04:09 PM Re: Help Needed: Multiple Script
chrishirst's Avatar
Super Moderator

Posts: 13,516
Location: Blackpool. UK
What it supposed to do? I know what it looks like it might be meant to but I'd like to check my guess is somewhere near.

My guess is to redirect on cursor key presses BTW. But it obviously won't 'cos the variables will only ever be set for the "right" direction.

what do you mean by "closing off all variables" and do we get a URL to test?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-24-2008, 04:18 PM Re: Help Needed: Multiple Script
Finney's Avatar
Skilled Talker

Posts: 91
Name: El Finney
Location: England, UK
I guess URLs to test dont really matter because the ones it goes to only update the database anyway.. What they do is use the id number for keys 'Q', 'W', 'A' and 'S'. It for controls of a game project I was doing. I ment close of like in PHP you open up your section eg.

if (query) {

..then to close it you follow with..

}

- Thats what I ment and I thought that would need doing to seperate the 4 action scripts.
Finney is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help Needed: Multiple Script
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11769 seconds with 12 queries