Passing an object as a paramter between windows
by "Hilma" <Hilma(at)hilma.freeserve.co.uk>
|
Date: |
Sun, 26 May 2002 15:52:24 +0100 |
To: |
<hwg-techniques(at)hwg.org> |
Cc: |
"Brett Errington" <brett(at)opensearch.com> |
References: |
brett |
|
todo: View
Thread,
Original
|
|
Many weeks ago :-)
i was asking about passing parameters to a new window.
And thanks to help from you people, i got it going successfully.
So now, a full-size image is opened up in my "imageWindow" (which i call
'HHPhotoSingle.htm') when you click on a thumbnail
http://mysite.freeserve.com/bbm/hagar/HH/HHVolBTCV.htm
----------------------------------------------------------------------------
-------------------------------------------------
JS Code:
http://mysite.freeserve.com/bbm/hagar/HH/HH_Photos.js
function openWindow(contentURL,windowName,windowWidth,windowHeight) {
widthHeight = 'height=' + windowHeight + ',width=' + windowWidth;
newWindow = window.open(contentURL,windowName,widthHeight);
newWindow.focus()
}
//I've no idea what "windowName" is for, i think i can drop it as an
argument as it never changes, but this is not an issue for now
----------------------------------------------------------------------------
-------------------------------------------------
http://mysite.freeserve.com/bbm/hagar/HH/HHVolBTCV.htm
Code in my HTML page defines the file name and path, the title, and the
window dimensions:
<a href="javascript:openWindow(HHPhotoSingle.htm?Pic=VolBTCV/BTCV01,Pete our
esteemed leader','myNewWindow',800,600)">
<img alt=".........."/>
</a>
----------------------------------------------------------------------------
-------------------------------------------------
Code in my HHPhotoSingle.htm :
http://mysite.freeserve.com/bbm/hagar/HH/HHPhotoSingle.htm
var mytext =location.search.substring(1);
var i = mytext.indexOf("=");
var j = mytext.indexOf(",");
photoname = mytext.substring(i+1, j);
phototitle = mytext.substring(j+1);
document.write("<h1>" + unescape(phototitle) + "</h1>");
document.write("<img src='images/" + photoname + ".jpg' />");
----------------------------------------------------------------------------
-------------------------------------------------
----------------------------------------------------------------------------
-------------------------------------------------
However:
I have now advanced ;-)
to using associative arrays;
My (offline) js now has an array called AllPhotos, such that i have 'photo'
objects, all about one photograph, things like:
AllPhotos.BTCV08.file
AllPhotos.BTCV08.path
AllPhotos.BTCV08.title
AllPhotos.BTCV08.alt
AllPhotos.BTCV08.width
AllPhotos.BTCV08.height
I know i need to use
AllPhotos.BTCV08.width
AllPhotos.BTCV08.height
in the call to openWindow;
but is there any way, using Client-side scripting (I'm not yet advanced
enough for server-side!) that i can pass the BTCV08 *photo object* to the
HHPhotoSingle.htm , via the openWindow call?
I can only see how to pass text strings, as i am currently doing;
but as a VB6 programmer, i like to think that i *can* pass an object (by
reference) to this new window.
However - my JS books and my JS knowledge are not up to it!
Any explanation and help much appreciated :-)
Hilma
---x---
----- Original Message -----
From: "Brett Errington" <brett(at)opensearch.com>
To: <hwg-techniques(at)hwg.org>
Sent: Sunday, May 05, 2002 2:55 PM
Subject: RE: Passing paramters between windows
> You can do this three ways (well probably more but these are the first
> that come to mind).
........
>
> If you need more help let me know.
>
> Later,
> Mr Brett
Yes please ;-))
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA