Forum Moderators: open

Message Too Old, No Replies

Javascript and PHP

Using a javascript popup window function with php for dynamic use...

         

PSWorx

6:32 pm on Nov 22, 2004 (gmt 0)

10+ Year Member



Is it possible to use this javascript function:

HTML SIDE:
javascript:openWhyEmail();

JAVASCRIPT SIDE:
function openWhyEmail()
{
var phpinfo=window.open"../page.php","","width=400,height=150,resizable=0,status=no,scrollbars=yes,screenX=100,screenY=100,top=100,left=100'");
}

Using a variable written into the javascript link using php like so using "imageLink" in the command i.e.

javascript:openWhyEmail(imageLink);

And then have the actual script do something along the lines of:

function openWhyEmail(imageLink)
{
var phpinfo=window.open"../page?imageLink=value.php","","width=400,height=150,resizable=0,status=no,scrollbars=yes,screenX=100,screenY=100,top=100,left=100'");
}

So as to (as an example) use the script for a popup window assigned to an image, which when clicked, loads a larger version of this image in the new window offerd by the javascripts new window and its attributes?

Thanks in advance

[edited by: DrDoc at 7:20 pm (utc) on Nov. 26, 2004]
[edit reason] removed smiley faces [/edit]

DrDoc

7:21 pm on Nov 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, that's perfectly possible...

Maybe I'm just dense... But were you simply asking if it can be done, or did you have problems with the code samples?

PSWorx

7:38 pm on Nov 27, 2004 (gmt 0)

10+ Year Member



Sorry yes i was wondering how it would be done, i should have made that clear in the first place.

Is it possible for you modify my example so i'm passing a variable from php to javascript and back to php again?

TIA

DrDoc

9:32 pm on Nov 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To use PHP variable in JavaScript:

var foo = '<? echo $foo;?>';


To pass a JavaScript variable back to PHP:

document.write('<a href="somepage.php?foo=' + foo + '">Link text</a>');

...or...

window.open("../page.php?foo=" + foo);

PSWorx

11:57 pm on Nov 28, 2004 (gmt 0)

10+ Year Member



Alright, i'm with that, but say ive got a couple of images as links on my site, above that is a larger version (in size) of those images - when i click on each of the three images the larger on changes to that of the smaller picture...

On the larger picture when clicked it opens a new window display a "zoomed" verions of the "larger" image of the "smaller" image (confusing huh... chuckle)... back to the point

When i change the "larger" image via the "smaller" one, is it possible, to load in the new window, the "zoomed" image that was chosen out of the three "smaller" images

This might sound confusing, trust me, it isn't

Thanks in advance