Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



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

Posts: 91
Name: El Finney
Location: England, UK
Trades: 0
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
__________________
»
Please login or register to view this content. Registration is FREE

»
Please login or register to view this content. Registration is FREE

»
Please login or register to view this content. Registration is FREE
Finney is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-24-2008, 05:09 PM Re: Help Needed: Multiple Script
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-24-2008, 05:18 PM Re: Help Needed: Multiple Script
Finney's Avatar
Skilled Talker

Posts: 91
Name: El Finney
Location: England, UK
Trades: 0
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.
__________________
»
Please login or register to view this content. Registration is FREE

»
Please login or register to view this content. Registration is FREE

»
Please login or register to view this content. Registration is FREE
Finney is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help Needed: Multiple Script
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.42299 seconds with 12 queries