Jump to content

Search the Community

Showing results for tags 'no repeat'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 2 results

  1. Hello, I'm trying to make a spinner that spins randomly on click (see example below). I've been messing around with this for hours, but I just cannot make this work like I want it to. This is my code, but it is unfinished and buggy: var myArray = ['360', '330', '300', '270', '240', '210', '180', '150', '120', '90', '60', '30']; var Spinner1 = sym.$('Spinner1'); // spinner 1 = wheel.jpg Spinner1.click(function(){ // randomize the degree of spin. var mySpin = myArray[Math.floor(Math.random() * myArray.length)]; sym.getSymbol('Spinner1').play(); Spinner1.css({ '-webkit-transform': 'rotate(' + mySpin + 'deg)', '-moz-transform': 'rotate(' + mySpin + 'deg)', '-ms-transform': 'rotate(' + mySpin + 'deg)', '-o-transform': 'rotate(' + mySpin + 'deg)', 'transform': 'rotate(' + mySpin + 'deg)', }); Spinner1.css('-webkit-transition','all 500ms cubic-bezier(0.420, 0.000, 1.000, 1.000)'); // calling alert pop-up on number if (mySpin > 330 && mySpin < 360) { alert("Winner is number 1!"); } }); What I am actually trying to achieve is the following: The spinner only spins clockwise (not clockwise and counter-clockwise) The spinner always spins 360 degrees + the random number/degrees defined in myArray (added on top of 360deg) The spinner randomly picks a number/degrees from myArray - but does not repeat that number again until all numbers have been spinned (resets after all spins) The spinner calls an alert pop-up when the pointer has landed on a number (between 1-12) If anyone can help me out or perhaps make my code work properly, I would be very happy. I really want to know what I am doing wrong so I can learn from it in the future. Help is sincerely appreciated! Regards, Entity_101 TestSpinner.zip
  2. Hello, I'm currently working on a school project involving a bunch of coding in html, css and js. The project's purpose is to basically build a website containing a 'quiz' system. I've already managed to successfully create one, but I'm not yet fully satisfied with it. The quiz contains 21 questions in total, and each question has their own html page; 21 pages in total. Now I have been using a java code to call a random page when a button is pressed on the home website (index.html). It works properly, but it often redirects me to the same page every time I click the button. I want to prevent it from visiting the same page whenever the button is pressed, until all 21 pages have been visited, at which point it resets the data and starts over. I have been looking for a kind of script for this, but can't seem to find it. My only option would be to ask for help, which is why I'm here. This is the code I am currently using for the page randomizer: var howMany = 20; // max number of items listed below var page = new Array(howMany+1); page[0]="spelopdracht1.html"; page[1]="spelopdracht2.html"; page[2]="spelopdracht3.html"; page[3]="spelopdracht4.html"; page[4]="spelopdracht5.html"; page[5]="spelopdracht6.html"; page[6]="spelopdracht7.html"; page[7]="spelopdracht8.html"; page[8]="spelopdracht9.html"; page[9]="spelopdracht10.html"; page[10]="spelopdracht11.html"; page[11]="spelopdracht12.html"; page[12]="spelopdracht13.html"; page[13]="spelopdracht14.html"; page[14]="spelopdracht15.html"; page[15]="spelopdracht16.html"; page[16]="spelopdracht17.html"; page[17]="spelopdracht18.html"; page[18]="spelopdracht19.html"; page[19]="spelopdracht20.html"; page[20]="spelopdracht21.html"; function rndnumber(){ var randscript = -1; while (randscript < 0 || randscript > howMany || isNaN(randscript)){ randscript = parseInt(Math.random()*(howMany+1)); } return randscript; } quo = rndnumber(); quox = page[quo]; window.location=(quox); } } If there is anything you can do, please let me know. I would really appreciate your help! ^.^
×
×
  • Create New...