RE: javaScript question

by "Brett Errington" <brett(at)opensearch.com>

 Date:  Tue, 22 Jan 2002 10:33:45 +0800
 To:  <hwg-techniques(at)mail.hwg.org>
 In-Reply-To:  sfo
  todo: View Thread, Original
Yes this is very doable.

Basically its putting your popUp function into your newWin function,
however I will give you slightly better code to use for newWin function.
So here is what I would use (This also centres the window according to
screen resolution).

function newWin(url)
	{
		var xMax = screen.width, yMax = screen.height;
		var xOffset = (xMax - 600)/2, yOffset = (yMax - 500)/2;
		CardWindow =
window.open(url,'Print','z-lock=yes,width=600,height=500,directories=no,
location=no,menubar=no,scrollbars=Yes,status=no,toolbar=no,resizable=no,
left='+xOffset+',top='+yOffset);
		CardWindow.focus();
	}

Your rand_link function should be able to stay the same now. All you
need to do is change the numbers 600 and 500 to what you want your
width/height to be. If you wish to send it variable width heights just
change the numbers to variables and then send the numbers to the
function along with the url. Any problems, just let me know.

Later,
Brett

"That's a pain that will shorely linger, and that's no lie" - Ed Grimley

-----Original Message-----
From: owner-hwg-techniques(at)hwg.org [mailto:owner-hwg-techniques(at)hwg.org]
On Behalf Of Valerie L Walker
Sent: Tuesday, 22 January 2002 9:15 AM
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,location=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