Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,671 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,189 people online right now. Registration is fast and FREE... Join Now!




Popups

 
Reply to this topicStart new topic

Popups

Pradeepk
post 25 Jun, 2007 - 11:03 PM
Post #1


New D.I.C Head

*
Joined: 22 Jun, 2007
Posts: 20


My Contributions


this is the code i have written....

CODE
echo "<script language=text/javascript>
              var newwindow;
              function poptastic(url)
              {
                newwindow=window.open(url,'name','height=400,width=200');
                if (window.focus) {newwindow.focus()}
              }
              </script>";
             echo "<a href='java script:poptastic('poppedexample.html');'>$text</a><br>";


where $text is the value which iam getting from database....

upto now its working fine....

but the popup is not opening...

[mod edit] use code tags mad.gif
User is offlineProfile CardPM

Go to the top of the page

girasquid
post 25 Jun, 2007 - 11:44 PM
Post #2


Barbarbar

Group Icon
Joined: 3 Oct, 2006
Posts: 1,256



Thanked 14 times

Dream Kudos: 650
My Contributions


You're not supposed to have a space in 'javascript' inside your a element. Also, a better way to do it would be like this:
CODE

<a href='#' onclick="poptastic('poppedexample.html');return false;">$text</a><br />


You should also put [code] tags around your code; it makes it a lot easier to read and distinguish.

This post has been edited by girasquid: 25 Jun, 2007 - 11:44 PM
User is offlineProfile CardPM

Go to the top of the page

Pradeepk
post 26 Jun, 2007 - 12:44 AM
Post #3


New D.I.C Head

*
Joined: 22 Jun, 2007
Posts: 20


My Contributions


CODE
echo "<a href=\"java script:openpopup('phpinfo.php')\">popup</a></br>";
    echo "<script language=\"JavaScript\" type=\"text/javascript\">";
    echo "var url;
          function openpopup(url){
          window.open(url,\"width=600,height=500, scrollbars=0, resizable=0\")
          }";


thia is the code i have written....
where i gone wrong...
thanks

[mod edit] use code tags mad.gif
User is offlineProfile CardPM

Go to the top of the page

Styx
post 26 Jun, 2007 - 01:23 AM
Post #4


D.I.C Head

Group Icon
Joined: 4 Mar, 2007
Posts: 192



Dream Kudos: 225
My Contributions


Well, your script works just fine except you forgot to put a name for window.open(url, name, attributes)

It would be better written just as:
CODE
<a href="java script:openpopup('phpinfo.php')">popup</a></br>
<script language="JavaScript" type="text/javascript">
function openpopup(url)
{
  window.open(url, url, 'width=600,height=500, scrollbars=0, resizable=0');
}
</script>

since it doesnt have much to do with php


(also, this forum adds a space in javascript for some reason)
User is offlineProfile CardPM

Go to the top of the page

Pradeepk
post 26 Jun, 2007 - 01:54 AM
Post #5


New D.I.C Head

*
Joined: 22 Jun, 2007
Posts: 20


My Contributions


QUOTE(Styx @ 26 Jun, 2007 - 02:23 AM) *

Well, your script works just fine except you forgot to put a name for window.open(url, name, attributes)

It would be better written just as:
CODE
[code]<a href="java script:openpopup('phpinfo.php')">popup</a></br>
<script language="JavaScript" type="text/javascript">
function openpopup(url)
{
  window.open(url, url, 'width=600,height=500, scrollbars=0, resizable=0');
}
</script>

since it doesnt have much to do with php


(also, this forum adds a space in javascript for some reason)







CODE
echo " <script language=\"javascript\" TYPE=\"text/javascript\"> ";
          echo "  var url
           function popup(mylink, windowname)
           {
             if (!window.focus)
             return true;
             if (typeof(mylink) == 'string')
                    href=mylink;
                else
                href=mylink.href;
                window.open(href, windowname, 'width=300,height=300,scrollbars=yes');
                return false;
           }
           </SCRIPT>";
            echo "<A HREF=\"timings.php\"
              onClick=\"return popup(this, 'notes')\">POPUP</A>";



this code is working good................

[mod edit] use code tags mad.gif
User is offlineProfile CardPM

Go to the top of the page

Styx
post 26 Jun, 2007 - 02:12 AM
Post #6


D.I.C Head

Group Icon
Joined: 4 Mar, 2007
Posts: 192



Dream Kudos: 225
My Contributions


glad you got it working anime1.gif
User is offlineProfile CardPM

Go to the top of the page

Pradeepk
post 26 Jun, 2007 - 02:49 AM
Post #7


New D.I.C Head

*
Joined: 22 Jun, 2007
Posts: 20


My Contributions


yes.....Thanks.........
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 06:04AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month