473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

making a popup window with javascript from within php

Hello

Can anyone tell me how to make a popup window with javascript from within a php code:

Here is my javascript:

[HTML]<script language="JavaScript">


function win1() {
window.open("Window1","menubar=no,width=460,height =360,toolbar=no");
}
</script>[/HTML]
and here is the php:

[PHP]<?php
print "<a href=" . Chr(34) . "search2.php?" . "JobNbr=" . $jtsstatus['TrackingNbr'] . Chr(34) . ">" . $jtsstatus['TrackingNbr'] . "</a>"; ?>[/PHP]

It is the search2.php that needs to open in a new window.
Aug 28 '07 #1
5 2208
dmjpro
2,476 2GB
Hello

Can anyone tell me how to make a popup window with javascript from within a php code:

Here is my javascript:

[HTML]<script language="JavaScript">


function win1() {
window.open("Window1","menubar=no,width=460,height =360,toolbar=no");
}
</script>[/HTML]
and here is the php:

[PHP]<?php
print "<a href=" . Chr(34) . "search2.php?" . "JobNbr=" . $jtsstatus['TrackingNbr'] . Chr(34) . ">" . $jtsstatus['TrackingNbr'] . "</a>"; ?>[/PHP]

It is the search2.php that needs to open in a new window.
If you want that in a separate Window then u need not to use window.open.
Just edit using ............!!

Expand|Select|Wrap|Line Numbers
  1. <a href=url_string target = _blank>LInk_name</a>
  2.  
If you want a customized window means the specific Height, Width or any Styles then u have to use window.open.
Then you can use.....!!

Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:void(0)" onclick = open_win(url_string)>Link_Name</a>
  2.  
Expand|Select|Wrap|Line Numbers
  1. function open_win(url_string)
  2. {
  3. window.open(url_string,"window_name",styles_you_want_to_customize);
  4. }
  5.  
I think you got my point what I want to tell you.
OK.
So Wish you a very Best Of Luck with your Try.

Kind Regards,
Dmjpro.
Aug 28 '07 #2
want a customized window to open, so i tried you second solution, but i am not sure that i am putting in the code in the php in the right way, because nothing happens when i click the link to open the new window. Maybe you can see what is wrong...????

Here is what i did:

Javascript code:

function open_win(search2.php)
{
window.open("search2.php","win","width=400,height= 400");
}

PHP Code:

[PHP]<?php
print "<a href='javascript:void(0)' onclick=" . Chr(34) . "open_win(search2.php?)" . "JobNbr=" . $jtsstatus['TrackingNbr'] . Chr(34) . ">" . $jtsstatus['TrackingNbr'] . "</a>"; ?>[/PHP]
Aug 28 '07 #3
dmjpro
2,476 2GB
want a customized window to open, so i tried you second solution, but i am not sure that i am putting in the code in the php in the right way, because nothing happens when i click the link to open the new window. Maybe you can see what is wrong...????

Here is what i did:

Javascript code:

function open_win(search2.php)
{
window.open("search2.php","win","width=400,height= 400");
}

PHP Code:

[PHP]<?php
print "<a href='javascript:void(0)' onclick=" . Chr(34) . "open_win(search2.php?)" . "JobNbr=" . $jtsstatus['TrackingNbr'] . Chr(34) . ">" . $jtsstatus['TrackingNbr'] . "</a>"; ?>[/PHP]
Look I am not a PHP man so I am unable to understand the syntax for PHP.
I am a J2EE man.
So I am sending you a sample code try it as I telling you.
Ok.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script language=JavaScript>
  4.     function win_open(url)
  5.     {
  6.         window.open(url,"win_"+Math.round(Math.random()*1000),"height:180px,width:500px");
  7.     }
  8. </script>
  9. </head>
  10. <body>
  11.     <a href="javascript:void(0)" onclick = "win_open('http://www.google.com/')">Google</a>
  12. </body>
  13. </html>
  14.  
Try this it will work fine and change the code according to your requirement.
Wish a best of luck with your Try.

Kind regards,
Dmjpro.
Aug 28 '07 #4
Thank you for your code. I will try and post the php issue in the php forum.
Aug 28 '07 #5
dmjpro
2,476 2GB
Thank you for your code. I will try and post the php issue in the php forum.
You better to do that.

Kind regards,
Dmjpro.
Aug 28 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: |-|erc | last post by:
Hi! Small challenge for you. The index.php uses this file and calls layout(). Take a look at www.chatty.net this file draws the chat login box on the right. I traced the CHAT button it submits...
5
by: Obantec Support | last post by:
Hi i leached some code and strung together a popup i need for a page with 5 help buttons. Now i could use 5 scripts and pre-load the values but i would rather get a better understanding of how...
38
by: Shaun McKinnon | last post by:
HI...Here's my problem...I have a popup window that loads when i want it to, but it's not sized properly. I've set the size, but it doesn't seem to work. I've been on 8 different websites to find...
3
by: Mehmet Gunacti | last post by:
Hello, on our homepage, when pressing an anchor tag, a special sized popup window opens via javascript. but it opens very slowly. on other web pages, there are also javascript-opened windows,...
1
by: Bill H | last post by:
I run a dbms application that interfaces with the web. This module creates a frames page with two frames ('main' and 'mwinfoframe'). All communication with the dbms is routed through the...
5
by: Jay | last post by:
I have a situation where the user clicks on a button in a DataGrid to launch a popup window via javascript. In the popup window the user does some things that result in changes to the underlying...
9
by: Rathtap | last post by:
I want to popup a window from my codebehind. The reason is that during the postback the code needs to do some validations and to build the arguments that are passed in the url. How can I achieve...
3
by: clsmith66 | last post by:
I am building an ASP.NET application where I have been required to make all the editing screens popup windows within the application. I didn't have any trouble creating the new windows but only...
7
by: ukrbend | last post by:
I use an iframe on my home page and everything works perfectly. But now I decided to add a popups to my page. The popups come not from within the iframe but from the parent frame. Again, everything...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.