RE: javaScript question

by "Mr.Wizard" <Mr.Wizard(at)pc-wizard.net>

 Date:  Mon, 21 Jan 2002 21:05:20 -0600
 To:  "Valerie L Walker" <wholebody(at)sfo.com>,
<hwg-techniques(at)mail.hwg.org>
 In-Reply-To:  sfo
  todo: View Thread, Original
First look at the script*****
1+Math.round(Math.random()*56);
Could be ---  Math.round(Math.random()*55);
To achive the same effect  Looks to me as you are adding 1 to 0 to get your
random number..
Any way to asnwer your question...
Give you new window som Params...
I.e.
if (a==1)

//these are some examples of Params you can give your new window.....


newWin("http://www.wiggage.com/images/VEE-DECKjpgs/3souls.html","toolbar=1,l
ocation=1,directories=1,menuBar=1,scrollbars=1,resizable=1,width=320,height=
120,left=100,top=100");

You will do this for all the windows you wish to set the params however you
can do it another way if all images are the same..

Let me know if you need more examples or if you wish to achive a better
speed load time of the script..

Mr.Wizard




> -----Original Message-----
> From: owner-hwg-techniques(at)hwg.org
> [mailto:owner-hwg-techniques(at)hwg.org]On Behalf Of Valerie L Walker
> Sent: Monday, January 21, 2002 7:15 PM
> To: hwg-techniques(at)mail.hwg.org
> Subject: javaScript question
>
>
> hi all--
>
> i have a page at http://www.wiggage.com/veedeck.html which has a button on
> it to pick a random card out of a deck of 56 cards. the
> javascript goes like
> this:
>
> function newWin(url) {
> window.location=url;
> }
> function rand_link() {
> var a;
> a = 1+Math.round(Math.random()*56);   // a = random number between 1-56
> if (a==1)
> newWin("http://www.wiggage.com/images/VEE-DECKjpgs/3souls.html");
> if (a==2) newWin("http://www.wiggage.com/images/VEE-DECKjpgs/altar.html");
> if (a==3)
> newWin("http://www.wiggage.com/images/VEE-DECKjpgs/asabove.html");
> if (a==4) newWin("http://www.wiggage.com/images/VEE-DECKjpgs/blank.html");
>
> ...etc. up to 56. works fine, except that i would like the pages to appear
> as popups sized to fit the cards rather than just going to the url of the
> card and having it be the same size as the main page.
>
> i have little popups on
> http://www.compostcoven.org/cnl/johex.html which use
> the following script:
>
> function popUp(page) {
> so=eval("window.open('"+page+"','so','toolbar=0,scrollbars=0,locat
> ion=0,stat
> us=0,menubars=0,resizable=0,width=120,height=120')")
> }
>
> so how do i combine these two scripts so that i get random
> card-sized popups
> when the button is clicked? is this doable?
>
> thanks much,
>
> Valerie Walker
> KG6ICP
> ---------------------------------------
> wholebody(at)sfo.com (home)
> valeriewalker_99(at)yahoo.com (away)
>
>  http://www.wiggage.com
> Online portfolio at http://www.wiggage.com/gallery.html
>
>
>
>
>

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA