473,766 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP & Javascript new window forces main page to load blank screen

I have a problem with a call a Javascript "window.ope n()" function which is
executed as part of a PHP file when a user clicks on an thumbnail image.
The PHP is executed which passes some variables to Javascript to execute
the new window opening. But as it does this, the main window is loaded
which is blank (the browser URL bar shows the URL of the URL passed to the
PHP / Javascript script).

I would like to keep the gallery page visible in the main page which is
where the link originally came from, so the user can see the gallery
underneath the "popup" window of the called graphic.

I don't know how much of an added problem it is, but the script that
generates the whole sites pages is in the root directory, and the gallery
HTML is in some seperate sub-directory and is "included" into the page
layout (using variables passed on a page click).

Any help appreciated.

Dariusz
Gallery script calling the PHP file to execute on image thumbnail click:

<a href="php/pics.php?&gal=c oll01&picID=01" ><img
src="img/gallery1/s-dg01.jpg" ALT="Picture 1" width="30"
height="69"></A>
<a href="php/pics.php?&gal=c oll01&picID=02" ><img
src="img/gallery1/s-dg02.jpg" ALT="Picture 2" width="74"
height="69"></A>

This passes the variables to the other PHP script which picture to grab.
PHP file with the Javascript (pics.php):

<?PHP
// Section to generate the Javascript pop-up for correct
// dimentions of the proposed pop-up.

$URL = '..img/gallery1/dg'.$_GET['picID'].'.jpg';

print "<script type=\"text/javascript\">
<!--

var Jurl=\"$URL\";
";

?>

window.
open(Jurl,"Pict ure","width=370 ,height=260,too lbar=no,menubar =no,
resizeable=no") ;

//-->
</script>
Jul 17 '05 #1
2 3404
jn
"Dariusz" <ng@lycaus.plus YOURSHIT.com> wrote in message
news:1_******** *************@w ards.force9.net ...
I have a problem with a call a Javascript "window.ope n()" function which is executed as part of a PHP file when a user clicks on an thumbnail image.
The PHP is executed which passes some variables to Javascript to execute
the new window opening. But as it does this, the main window is loaded
which is blank (the browser URL bar shows the URL of the URL passed to the
PHP / Javascript script).

I would like to keep the gallery page visible in the main page which is
where the link originally came from, so the user can see the gallery
underneath the "popup" window of the called graphic.

I don't know how much of an added problem it is, but the script that
generates the whole sites pages is in the root directory, and the gallery
HTML is in some seperate sub-directory and is "included" into the page
layout (using variables passed on a page click).

Any help appreciated.

Dariusz
Gallery script calling the PHP file to execute on image thumbnail click:

<a href="php/pics.php?&gal=c oll01&picID=01" ><img
src="img/gallery1/s-dg01.jpg" ALT="Picture 1" width="30"
height="69"></A>
<a href="php/pics.php?&gal=c oll01&picID=02" ><img
src="img/gallery1/s-dg02.jpg" ALT="Picture 2" width="74"
height="69"></A>

This passes the variables to the other PHP script which picture to grab.
PHP file with the Javascript (pics.php):

<?PHP
// Section to generate the Javascript pop-up for correct
// dimentions of the proposed pop-up.

$URL = '..img/gallery1/dg'.$_GET['picID'].'.jpg';

print "<script type=\"text/javascript\">
<!--

var Jurl=\"$URL\";
";

?>

window.
open(Jurl,"Pict ure","width=370 ,height=260,too lbar=no,menubar =no,
resizeable=no") ;

//-->
</script>


This seems a strange way to do it.

On your thumbnail page, include a function to open a window using a url
passed to it.

(this script is untested, but you get the idea)

<script>
function open(url){
window.open(url ,"Picture","wid th=370,height=2 60,toolbar=no,m enubar=no,resiz e
able=no");
}
</script>

Inside your thumbnail links, just call your function with the correct url:

<a href="#" onclick="open(' ..img/gallery1/1.jpg')">

That way, you don't need to load a separate page in the main window just to
open.
Jul 17 '05 #2

"jn" <us************ *************** *****@jasonnorr is.net> wrote in message
news:d_******** *************@t wister.tampabay .rr.com...
<script>
function open(url){
window.open(url ,"Picture","wid th=370,height=2 60,toolbar=no,m enubar=no,resiz e able=no");
}
</script>

Inside your thumbnail links, just call your function with the correct url:

<a href="#" onclick="open(' ..img/gallery1/1.jpg')">


If you have to scroll down to see the thumbnail you want to
"enlarge", your way would open a new window and because
of this # it would cause browser to move "focus" to the top
of the main page, so for next image, we would have to scroll
down again to see thumbnails, etc...
Another thing, if somebody tries to open that link in a new
window, 2 windows will be open, one for the image, and
another for the main page.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6819
by: Da Costa Gomez | last post by:
Hi all, I've been eluded the last couple of *days* on the onload mystery within the frame and function context. Problem is as follows: - frameset with two frames. One called scripts and the other called main - scripts carries a bunch of js functions rechable via parent.scripts.functioName() - Main carries the html page that utilizes some functions
1
19595
by: HockeyTownUSA | last post by:
I am working a project where I am using two monitors and using HTML/Javascript to display the information I want. I have my main stuff on the main monitor, but when each page loads, I want an image to load fullscreen on the second monitor as well. I am using 800x600 resoution on both. If I use: function openWindow()
53
5741
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is difficult to know what is going on. One of these Order Forms you can see here... http://www.cardman.co.uk/orderform.php3
3
2030
by: annon | last post by:
I've noticed that some problems come up frequently that are of importance in writing web pages, because they're pretty fundamental points. For general reference, here are some collected solutions. 1. Opens a new Window at maximum size: window.moveTo(0,0,screenX=0,screenY=0) window.resizeTo(screen.availWidth+2,screen.availHeight+6)
8
1681
by: Terry | last post by:
I am loading a javascript function from my asp.net app. This function loads a string passed to it in a new window. I register the function to activate on click of an asp linkbutton. Now when ever I click the link button the window pops up with the string passed to it but it gets minimised automatically. Even using win.focus() does'nt seem to stop it from minimising. How can I stop this from happening
18
7334
by: William | last post by:
I have the following javascript function that updates a scroll_list and sends the updated entry (with its index) to a server script ( i.e. http://mkmxg00/cgi/confirmUpload.pl ) for further processing: function saveText( scroll_list, t_area, listToBeUpdated ) { scroll_list.options.text = t_area.text; scroll_list.options.value= t_area.value; var req; var url = "http://mkmxg00/cgi/confirmUpload.pl";
0
5573
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
4
68265
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer must be embedded somewhere in the source code, and I would like to know if anyone knows where to find the correct answer. I would greatly appreciate it!! Thanks!!
7
5812
by: Bill H | last post by:
When I do website design I have my screen (on a PC) set for 1600 x 1200 or greater resolution so that I can have as many windows open as I need and not have to flip between them. The issue I have is the the IE7 window is never a consistant size because I resize it as I am using it. I would like to be able to open up a blank IE 7 window and have it set to a specific size each time so that I can see the pages I am working on in the same...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10008
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9837
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.