Hi Everyone,
How can i use a Javascript window popup name in the PHP??
I have windowA, windowB and windowC in my application. When i close windowA, i want windowB to refresh and windowC to be close too. can i do that with PHP or need to adding in the javascript??
Anyone got any IDEAS with this?? Thanks
Here is my code:
This is the open popup window script that i use in the window.js
(I use dynamic window name that pass in from windowA, different window have different name)
function child_window(mylink, windowname, winfeatures)
{
var mywin, href;
href = mylink.href;
mywin = window.open(mylink, windowname, winfeatures);
}
How to use Javascript window name in PHP?
Moderator: General Moderators
I assume you're talking about pop-up windows?
you can do it all with js, however almost every browser nowadays will not work with the onUnLoad event.
you'd therefore be "requiring" your users to click a link to close your browser a window and manipulate stuff on browser b and c.
you just need to give each window a variable name and then you can do stuff with them as follows:
you can do it all with js, however almost every browser nowadays will not work with the onUnLoad event.
you'd therefore be "requiring" your users to click a link to close your browser a window and manipulate stuff on browser b and c.
you just need to give each window a variable name and then you can do stuff with them as follows:
Code: Select all
bob.window.close();
// or
bill.document.MyForm.somefield.value = "blah";
// etcHi Burrito and AnarKy,
Thanks for the advice
So, thats mean i need to declare a variable for each popup window, right?
Like:
windowA = window.open('url.php,'windowname',features);
windowB = window.open('address.php,'windowname',features);
and we call the windowA or windowB every time we want to perform actions to that particular window, right??
Then, how about if my window is a dynamic window which passing the 'windowname' throught php page??
For example:
In php file:
$_session['user_ID']=$ID;
$_session['category']=$choice;
print('<a href="hello.php" onClick="return special_window(this,\''.$ID.$choice.'\',\'toolbar=No,menubar=No,scrollbars=Yes\')">click here</a>');
//so the $ID and the $choice will be different when the user click on different category(each category will open a popup window).
In window.js file
function open_window(url,name,feature)
{ windowA = window.open(url,name,feature);
so, the 'windowname' will be different each time a popup window created......
For this case, can i just declare the window open like that...??
function open_window(url,name,feature)
{ name = window.open(url,name,feature);
but when i put this script in, i close window but nothing happen....
Anyone can help me?? thanks
Thanks for the advice
So, thats mean i need to declare a variable for each popup window, right?
Like:
windowA = window.open('url.php,'windowname',features);
windowB = window.open('address.php,'windowname',features);
and we call the windowA or windowB every time we want to perform actions to that particular window, right??
Then, how about if my window is a dynamic window which passing the 'windowname' throught php page??
For example:
In php file:
$_session['user_ID']=$ID;
$_session['category']=$choice;
print('<a href="hello.php" onClick="return special_window(this,\''.$ID.$choice.'\',\'toolbar=No,menubar=No,scrollbars=Yes\')">click here</a>');
//so the $ID and the $choice will be different when the user click on different category(each category will open a popup window).
In window.js file
function open_window(url,name,feature)
{ windowA = window.open(url,name,feature);
so, the 'windowname' will be different each time a popup window created......
For this case, can i just declare the window open like that...??
function open_window(url,name,feature)
{ name = window.open(url,name,feature);
but when i put this script in, i close window but nothing happen....
Anyone can help me?? thanks