Help ATS with a contribution via PayPal:
learn more

Web Design "Mini Lesson" Thread

page: 2
7
<< 1   >>

log in

join

posted on Mar, 17 2012 @ 02:11 AM
link   
Not PHP, but it's a script. Well, _javascript at least. Just a simple function of sorts. Maybe not pro either (I wouldn't be surprised if it's considered clumsy coding), but I'm guessing it has its uses...



function arrayShuffler(inputArray) {
seedArray = new Array();
targetArray = new Array();
tempArray = new Array();
counter = 0
for (i=0; i 0) {
randNum = parseInt(Math.random() * sourceArray.length);
targetArray[ counter] = seedArray[ randNum];
seedArray.splice(randNum,1);
tempArray[ counter] = inputArray[ targetArray[ counter]];
counter++;
}
return tempArray;
}


Then to use it later on...



array_toBeShuffled = arrayShuffler(array_toBeShuffled);


Hopefully I didn't break it by changing it for this post. (Some variable names changed around for clarity and adding a space to the square brackets so they don't parse as forum code.) If you couldn't figure it out, it randomizes the order of any array. I'm sure a list of non-repeating randomized values has some uses. (Card games, quiz questions, other more creative things, etc.)

As for a method to the madness? I find using a loop to populate a seed array and then randomly taking parts of the seed array away to generate another array which in turn is used to reorder the array put into the function is a lot faster than performing comparison checks to see that a random value doesn't repeat. (The list of values to randomly choose from gets shorter each time it repeats. As where checking the whole thing would keep bumping into the same values over and over again if you didn't want a repeat.) I don't do much programming, so it took me a while to figure that one out.
edit on 17-3-2012 by pauljs75 because: (no reason given)




posted on Jun, 30 2013 @ 04:22 AM
link   
Im downloading the trial version of Dreamweaver CC (version 13). I want to learn web page design and the trial version last for 30 days.



posted on Jun, 30 2013 @ 05:11 AM
link   
This appears a good tutorial site for learning html script.

www.htmldog.com...



posted on Jul, 1 2013 @ 03:36 AM
link   
reply to post by AthlonSavage
 


Maybe its been said here--this is an old thread... Learning DW is great, but knowing how to manually code is paramount IMHO. Check w3schools, even after 10+ years working as a designer/developer I still visit them when I have those brain blocks

www.w3schools.com...




posted on Jul, 1 2013 @ 07:00 AM
link   
reply to post by cartenz
 


I am taking your advice and starting with the basics doing a Html tutorial on the net. Here is my first web page creation





posted on Feb, 24 2014 @ 04:23 AM
link   
Most of the website development and website design services offered by the companies in magento are designed in such a manner that they are sufficient to meet all your desired business needs and requirements. At present, number of corporate business companies have upgraded and equipped their digital services with the latest website development services, offering them in return with a huge return on their online investment.
www.ptiwebtech.com.au...





new topics

top topics
 
7
<< 1   >>

log in

join