/    Sign up×
Community /Pin to ProfileBookmark

Ok, I’m working on a page which will hold lunarium codes for the AMIGA version of a game called Rocket Ranger (Like the movie “The Rocketeer”.)
I want the people to use two dropdown menu’s to choose the land they came from and the land they’re going to and then give them the code instantly without having to submit it.
I got the dropdown menu’s to work, with landcodes 000 to 026 for the “from” and 100 to 126 for the “to” menu.
Now all I want is the code for the box which gives them the correct amount of lunarium (2 digits).
Can anyone help me with that?
This is the code I have so far:

[quote]

*Removed to shorten the thread*

[/quote]

If anyone could help me further, I would appreciate it.

to post a comment
JavaScript

14 Comments(s)

Copy linkTweet thisAlerts:
@AlcarcalimoauthorFeb 14.2003 — No, I've got a whole list of 2 digit codes, all I need is for the site to find the correct location of the code.

You know, get the from+to codes and find the correct number.

Like this:

From Algeria

to Arabia

Code = 000 + 001 = 28

With the 28 located on the (000,001) coordinates.
Copy linkTweet thisAlerts:
@khalidali63Feb 14.2003 — I guess this is what you want

<i>
</i>&lt;script type="text/javascript"&gt;
function process(){
var first = document.CountryForm.CountryFrom[document.CountryForm.CountryFrom.selectedIndex].value;
var second = document.CountryForm.CountryTo[document.CountryForm.CountryTo.selectedIndex].value;
// 2 values first and second you can do calculations at.
if(first!=="-111" &amp;&amp; second!="-111"){//make sure both boxes are selected
alert(first+" , "+second);
}
//delete the alert line above when u do not need it
}

&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;form name="CountryForm"&gt;
&lt;table bordercolorlight="#C0C0C0" border="2" bordercolordark="#000000" bordercolor="#808080"&gt;
&lt;tr&gt;
&lt;td align=center&gt;&lt;b&gt;From:&lt;/b&gt;&lt;/td&gt;
&lt;td align=center&gt;&lt;b&gt;To:&lt;/b&gt;&lt;/td&gt;
&lt;td align=center&gt;&lt;b&gt;Amount of Lunarium:&lt;b&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=center&gt;
&lt;select name="CountryFrom" class="codes" onchange="process();"&gt;
&lt;option value="-111"&gt;----&lt;/option&gt;
&lt;option value="000"&gt;Algeria&lt;/option&gt;
&lt;option value="001"&gt;Arabia&lt;/option&gt;
&lt;option value="002"&gt;Atlantic&lt;/option&gt;
&lt;option value="003"&gt;Brazil&lt;/option&gt;
&lt;option value="004"&gt;Canada&lt;/option&gt;
&lt;option value="005"&gt;Columbia&lt;/option&gt;
&lt;option value="006"&gt;Congo&lt;/option&gt;
&lt;option value="007"&gt;East Africa&lt;/option&gt;
&lt;option value="008"&gt;Egypt&lt;/option&gt;
&lt;option value="009"&gt;England&lt;/option&gt;
&lt;option value="010"&gt;France&lt;/option&gt;
&lt;option value="011"&gt;Germany&lt;/option&gt;
&lt;option value="012"&gt;Italy&lt;/option&gt;
&lt;option value="013"&gt;Kenya&lt;/option&gt;
&lt;option value="014"&gt;Libya&lt;/option&gt;
&lt;option value="015"&gt;Mideast&lt;/option&gt;
&lt;option value="016"&gt;Nigeria&lt;/option&gt;
&lt;option value="017"&gt;Persia&lt;/option&gt;
&lt;option value="018"&gt;Peru&lt;/option&gt;
&lt;option value="019"&gt;Scandinavia&lt;/option&gt;
&lt;option value="020"&gt;Spain&lt;/option&gt;
&lt;option value="021"&gt;Sudan&lt;/option&gt;
&lt;option value="022"&gt;U.S.A.&lt;/option&gt;
&lt;option value="023"&gt;U.S.S.R.&lt;/option&gt;
&lt;option value="024"&gt;Venezuela&lt;/option&gt;
&lt;option value="025"&gt;West Africa&lt;/option&gt;
&lt;option value="026"&gt;Yugoslavia&lt;/option&gt;
&lt;/select&gt;
&lt;/td&gt;
&lt;td align=center&gt;
&lt;select name="CountryTo" class="codes" onchange="process();"&gt;
&lt;option value="-111"&gt;----&lt;/option&gt;
&lt;option value="100"&gt;Algeria&lt;/option&gt;
&lt;option value="101"&gt;Arabia&lt;/option&gt;
&lt;option value="102"&gt;Atlantic&lt;/option&gt;
&lt;option value="103"&gt;Brazil&lt;/option&gt;
&lt;option value="104"&gt;Canada&lt;/option&gt;
&lt;option value="105"&gt;Columbia&lt;/option&gt;
&lt;option value="106"&gt;Congo&lt;/option&gt;
&lt;option value="107"&gt;East Africa&lt;/option&gt;
&lt;option value="108"&gt;Egypt&lt;/option&gt;
&lt;option value="109"&gt;England&lt;/option&gt;
&lt;option value="110"&gt;France&lt;/option&gt;
&lt;option value="111"&gt;Germany&lt;/option&gt;
&lt;option value="112"&gt;Italy&lt;/option&gt;
&lt;option value="113"&gt;Kenya&lt;/option&gt;
&lt;option value="114"&gt;Libya&lt;/option&gt;
&lt;option value="115"&gt;Mideast&lt;/option&gt;
&lt;option value="116"&gt;Nigeria&lt;/option&gt;
&lt;option value="117"&gt;Persia&lt;/option&gt;
&lt;option value="118"&gt;Peru&lt;/option&gt;
&lt;option value="119"&gt;Scandinavia&lt;/option&gt;
&lt;option value="120"&gt;Spain&lt;/option&gt;
&lt;option value="121"&gt;Sudan&lt;/option&gt;
&lt;option value="122"&gt;U.S.A.&lt;/option&gt;
&lt;option value="123"&gt;U.S.S.R.&lt;/option&gt;
&lt;option value="124"&gt;Venezuela&lt;/option&gt;
&lt;option value="125"&gt;West Africa&lt;/option&gt;
&lt;option value="126"&gt;Yugoslavia&lt;/option&gt;
&lt;/select&gt;
&lt;/td&gt;
&lt;td align=center&gt;&lt;INPUT TYPE="text" NAME="output" SIZE="2" onFocus="this.blur()"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;



Khalid
Copy linkTweet thisAlerts:
@AlcarcalimoauthorFeb 14.2003 — eehm.. well, yes... but...

I think we're not on the same line.. It maight be me (I'm certain it is...), but I mean to say, I've got 26x26 codes.

All of them need to be put in a list, from where they can be found with the "from"+"to" selectors.

When they are found in such a way, they need to be put in a read-only box of 2 digits wide.

It doesn't matter to me how big a code I have to use, as long as it works.

Got it? (English is not my native language, so I hope I said it right...)
Copy linkTweet thisAlerts:
@khalidali63Feb 14.2003 — In that case you have to revisit the whole logic,or to be the least you have to have another array or two that can hold the calculattion values which are then retrieved upon selections from the 2 existing drop downs.

I'd say, at this point, create a file with all of the data which you wnat ot be worked on and explain how exactly you want it to be coded,may be some one can help.to let us all keep guessing will not do any good.

cheers

Khalid
Copy linkTweet thisAlerts:
@AlcarcalimoauthorFeb 14.2003 — ....I'm afraid I'm a little overwhelmed with that code.

I tried to paste it on several places, but I don't know what to think of it and the best I get is that it shows an error message.

Ok, what I want is the following:

This is the thing I have at the moment:

___A__B__C__D__E

A_01_02_03_04_05

B_06_07_08_09_10

C_11_12_13_14_15

D_16_17_18_19_20

E_21_22_23_24_25

This is what I want:

From:__
_
____To:_________Code:

(Selector1)__
(Selector2)__(Read-only box which shows the correct code.)

When Selector1 is set to A and Selector2 to B, the box should read 06.

When the Selectors are set to C,E it should change to 23 without prompting.

I hope this helps...?
Copy linkTweet thisAlerts:
@AlcarcalimoauthorFeb 14.2003 — ..eehm.. ok, but where do I put the array?
Copy linkTweet thisAlerts:
@AlcarcalimoauthorFeb 14.2003 — Well, it won't work! So either I've done something completely stupid, or the code ain't right.

I'll paste it here:

*Removed to shorten the thread*
[/quote]
Copy linkTweet thisAlerts:
@Zach_ElfersFeb 14.2003 — All your arrays with your 26 numbers are in between <script> and </script> tags. Change the first to <script language="JavaScript" type="text/JavaScript">
Copy linkTweet thisAlerts:
@AlcarcalimoauthorFeb 14.2003 — :eek: oops! Dôh! :p

...

But it still won't work! :mad:
Copy linkTweet thisAlerts:
@Zach_ElfersFeb 14.2003 — Try cutting all those arrays out and pasting them before the function in the top script.
Copy linkTweet thisAlerts:
@AlcarcalimoauthorFeb 14.2003 — like this?

*Removed to shorten the thread*
[/quote]
Copy linkTweet thisAlerts:
@AlcarcalimoauthorFeb 15.2003 — oh... ?

Is this ok?

*Removed to shorten the thread*
[/quote]

I'm really struggling with this.....
Copy linkTweet thisAlerts:
@AlcarcalimoauthorFeb 15.2003 — YAY! ?

Many thanks!

It actually works!

Now all I have to do is to change the 26x26 codes to the good ones.... :rolleyes:

But this helps A LOT! ?
Copy linkTweet thisAlerts:
@AlcarcalimoauthorFeb 15.2003 — Oh, yes! :rolleyes:

Ok, you got me there....

I'll just put a link to your site on that page, to let people know who helped me code this thing. ?

(Plus, I wrote in your guestbook! :p )
×

Success!

Help @Alcarcalimo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...