473,322 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

a numbers puzzle?

Hello,

say I have events numbered 1 to 7 and wish to prevent all except the
current one.

ie
when 1 allowed prevent 2-7
when 2 allowed prevent 1 and 3-7
when 3 allowed prevent 1-2 and 4-7
when 4 allowed prevent 1-3 and 5-7
when 5 allowed prevent 1-4 and 6-7
when 6 allowed prevent 1-5 and 7
when 7 allowed prevent 1-6

how do I do this in Javascript?

Cheers

Geoff
Jun 27 '08 #1
4 925
Geoff Cox <gc**@freeuk.notcomwrites:
say I have events numbered 1 to 7 and wish to prevent all except the
current one.

ie
when 1 allowed prevent 2-7
when 2 allowed prevent 1 and 3-7
when 3 allowed prevent 1-2 and 4-7
when 4 allowed prevent 1-3 and 5-7
when 5 allowed prevent 1-4 and 6-7
when 6 allowed prevent 1-5 and 7
when 7 allowed prevent 1-6

how do I do this in Javascript?
if (eventNumber != currentEventNumber) {
disallowEvent();
}

Now, for us to do anything less generic, you should supply more detail.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jun 27 '08 #2
On Sun, 11 May 2008 21:34:19 +0200, Lasse Reichstein Nielsen
<lr*@hotpop.comwrote:
>Geoff Cox <gc**@freeuk.notcomwrites:
>say I have events numbered 1 to 7 and wish to prevent all except the
current one.

ie
when 1 allowed prevent 2-7
when 2 allowed prevent 1 and 3-7
when 3 allowed prevent 1-2 and 4-7
when 4 allowed prevent 1-3 and 5-7
when 5 allowed prevent 1-4 and 6-7
when 6 allowed prevent 1-5 and 7
when 7 allowed prevent 1-6

how do I do this in Javascript?

if (eventNumber != currentEventNumber) {
disallowEvent();
}

Now, for us to do anything less generic, you should supply more detail.

/L
Lasse,

Thanks for the above - I am using

for (var count=1;count<t;count++){
if (count != t) {
soundManager.stop('mySound'+count);
document.getElementById('IMG'+(count)).src=played2 .src;
}
}

Which doesn't quite work as it stops counting up once the count is not
equal to t. How do I make the count continue?

Cheers

Geoff
Jun 27 '08 #3
On Sun, 11 May 2008 21:34:19 +0200, Lasse Reichstein Nielsen
<lr*@hotpop.comwrote:

Lasse,

I think I've got it right now! I need count < 7 not count < t.

Cheers

Geoff

for (var count=1;count<7;count++){
if (count != t) {
soundManager.stop('mySound'+count);
document.getElementById('IMG'+(count)).src=played2 .src;
}
}

Jun 27 '08 #4
On Sun, 11 May 2008 21:34:19 +0200, Lasse Reichstein Nielsen
<lr*@hotpop.comwrote:

ah! should have been count < 8 ie 1 more than the number of events.

Cheers

Geoff
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

89
by: purifier | last post by:
The problem is to write a program in 'C' to find the greatest of 2 given numbers... Easy? huh here's the catch do not use 'if' or any conditional statements if u want it to be a little more...
9
by: Harsha Srinath | last post by:
Athough this might not be directly relayed to C syntax, I thought some of you may find this an interesting problem :- 1.One number, in an array integers from 1 to 1,000,000 is present twice. How...
1
by: xavier vazquez | last post by:
I have a problem with a program that does not working properly...when the program run is suppose to generate a cross word puzzle , when the outcome show the letter of the words overlap one intop of...
0
by: xavier vazquez | last post by:
have a problem with a program that does not working properly...when the program run is suppose to generate a cross word puzzle , when the outcome show the letter of the words overlap one intop of the...
0
by: newstips6706 | last post by:
1, 2, 3, 5, 7... PRIME Numbers ________________________________ Definitions What is a PRIME Number ?
3
by: oncue01 | last post by:
Word Puzzle Task You are going to search M words in an N × N puzzle. The words may have been placed in one of the four directions as from (i) left to right (E), (ii) right to left (W), (iii) up...
4
by: silversnake | last post by:
hi I'm trying to write a function that check through a 2d array of numbers and check if they are in order or not e.g 1 2 3 4 5 6 the function will return TURE 3 2 4 6 1...
6
by: Phoe6 | last post by:
Hi All, I would like to request a code and design review of one of my program. n-puzzle.py http://sarovar.org/snippet/detail.php?type=snippet&id=83 Its a N-puzzle problem solver ( Wikipedia page...
35
by: aarklon | last post by:
Hi all, The following question is asked frequently in interviews How to find the greatest of 2 numbers without using relational operators ? the solution i have seen is ( a+b + abs(a-b) )...
4
by: honey777 | last post by:
Problem: 15 Puzzle This is a common puzzle with a 4x4 playing space with 15 tiles, numbered 1 through 15. One "spot" is always left blank. Here is an example of the puzzle: The goal is to...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.