[Javascript] XMLHttpRequest help (yeah, yeah, I know)
Flavio Gomes
flavio at economisa.com.br
Tue Aug 2 15:20:00 CDT 2005
Would it be a big problem if you simply downloaded all the quotes to the
user in an array and then choose one randomly through
"myQuotes[Math.floor(Math.random() * myQuotes.length)]".
================================================
//Example
myQuotes = new Array();
myQuotes[myQuotes.length] = "Something";
myQuotes[myQuotes.length] = "Kinda";
myQuotes[myQuotes.length] = "Nice";
myQuotes[myQuotes.length] = "May";
myQuotes[myQuotes.length] = "Happen";
for (x=0; x< 25; x++)
{ myIndex = Math.floor(Math.random() * myQuotes.length);
document.write(myIndex + ': ' + myQuotes[myIndex] + '<br>');
}
================================================
Yeah, it's f**king newbie stuff.. T_T
But soooo pretty much crossbrowser and stuff
Hope to Help,
--
Flavio Gomes
flavio at economisa.com.br
Matt Warden wrote:
>Mike Stickel wrote:
>
>
>>Searching through the web-o-sphere I've seen many tutorials on
>>XMLHttpRequest and looked through a good many of them. Trying to apply
>>their logic and examples to this particular case have gotten me
>>thoroughly confused though. Maybe what would help is if a kind soul
>>could write out, in plain english, the flow of how the js should work
>>then I can at least take a stab at writing the functions. You know the
>>old adage, learn by doing and all that.
>>
>>
>
>http://www.devx.com/webdev/Article/28695
>
>There is an example of simple DOM manipulations based on the XML
>content received in the downloadable code. If you have questions, let
>me know.
>
>- --
>Matt Warden
>Miami University
>Oxford, OH, USA
>http://mattwarden.com
>
>
More information about the Javascript
mailing list