Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 3 123 LastLast
Results 1 to 15 of 33
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    The Omega-3 system
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy HELP! can't figure out this pop-up

    Howdy,

    I have been struggling with a couple of scripts I found at javascriptkit.

    I simply want a pop-up window but I would like a button instead of a text link that activates the pop-up (like the one they have in their pop-up tutorial)


    <form>
    <input type="button" value="Click here to see">
    onclick="window.open('page2.htm',
    'win1','width=200,height=200')"
    </form>

    But I am also having trouble with the pop-up script that was generated for me with their pop-up wizard.


    <script>

    //Popup Window Script
    //By JavaScript Kit (http://javascriptkit.com)
    //JavaScript tutorials and over 400+ free scripts

    function openpopup(){
    var popurl="venice_beach_sunsetpoll.htm"
    winpops=window.open(venice_beach_sunsetpoll.htm,"","width=400,height=338,scrollbars,resizable,")
    }

    </script>

    <a href="javascript:openpopup()"><font color="#FFFFFF">Please cast your vote on this photo CLICK HERE</font></a>


    When I preview it in my browser it says "venice_beach_sunsetpoll.htm is undefined"

    Being a cut and paste kinda programmer I don't know what this means.

    Since I am conducting a poll in this pop-up window I want my visitors to view the results in the same pop-up window but is there a way to make the dimensions of the result page different?

    If someone could marry the two scripts above and show me what I am doing wrong overall I would really appreciate it.



    Thank You!
    Last edited by ubtheboss; 06-19-2002 at 01:10 AM.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    Try something like this:


    <script>

    //Popup Window Script
    //By JavaScript Kit (http://javascriptkit.com)
    //JavaScript tutorials and over 400+ free scripts

    function openpopup(){
    var popurl="venice_beach_sunsetpoll.htm"
    winpops=window.open(popurl,"","width=400,height=338,scrollbars,resizable,")
    }

    </script>
    <form>
    <input type="button" value="Click here to see" onclick="openpopup()" >
    </form>


    You had venice_beach_sunsetpoll.htm written out instead of calling the variable that represented it.

  • #3
    New Coder
    Join Date
    Jun 2002
    Location
    The Omega-3 system
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you John.

    Another question:

    - I want to put two of these scripts on one page. I tried changing the variable 'popurl' of one of them to 'popurl2' but that didn't work.

    ??

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    Try something like this:

    <script>

    //Popup Window Script
    //By JavaScript Kit (http://javascriptkit.com)
    //JavaScript tutorials and over 400+ free scripts

    function openpopup(popurl){
    winpops=window.open(popurl,"","width=400,height=338,scrollbars,resizable,")
    }

    </script>
    <form>
    <input type="button" value="Click here to see" onclick="openpopup('venice_beach_sunsetpoll.htm')" >
    <input type="button" value="Click here to see" onclick="openpopup('a_different_page.htm')" >
    </form>

    this way you pass in the page as a variable

  • #5
    New Coder
    Join Date
    Jun 2002
    Location
    The Omega-3 system
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks again John.

    That works but the problem is that I need different sized windows for each function/button (one calls up a poll and the other a guestbook sign in form)

    Can you help me with that?

    Cheers!

    Phil

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    Sure just pass those in too:

    <script>

    //Popup Window Script
    //By JavaScript Kit (http://javascriptkit.com)
    //JavaScript tutorials and over 400+ free scripts

    function openpopup(popurl,settings){
    winpops=window.open(popurl,"",settings)
    }

    </script>
    <form>
    <input type="button" value="Click here to see" onclick="openpopup('venice_beach_sunsetpoll.htm','width=400,height=338,scrollbars,resizable,')" >
    <input type="button" value="Click here to see" onclick="openpopup('a_different_page.htm','width=200,height=200')" >
    </form>

  • #7
    New Coder
    Join Date
    Jun 2002
    Location
    The Omega-3 system
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That works! Once again, thank you.

    One small problem though. For some reason my pop-up windows are starting to pop-up with half of the window half off the screen to the right. I have to click on the top bar of the window and drag it to the left so the whole window is visible on screen.

    What is causing this and is there a cure?

    Cheers!

    Phil

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try this popup generator:

    http://www.a1ien51.8k.com/scripts/popupwingenV2.htm

    It rocks...

    You can use the code it generates (including centering), and modify it to pass the variables you want into your function...

    Like:

    <script language="javascript" type="text/javascript">
    <!--
    function PopUp(PopUpUrl,thewidth,theheight){
    var ScreenWidth=window.screen.width;
    var ScreenHeight=window.screen.height;
    var movefromedge=0;
    placementx=(ScreenWidth/thewidth)-((thewidth)/2);
    placementy=(ScreenHeight/theheight)-((theheight+50)/2);
    WinPop=window.open(PopUpUrl,"","width="+thewidth+",height="+theheight+",toolbar=0,location=0,directo ries=0,status=0,scrollbars=0,menubar=0,resizable=0,left="+placementx+",top="+placementy+",screenX="+ placementx+",screenY="+placementy+",");
    }
    // -->
    </script>

    <a href="javascript:PopUp('http://www.barbie.com',400,300)">Barbie</a><br />
    <a href="javascript:PopUp('http://www.yahoo.com',800,600)">Yahoo!</a><br />
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #9
    New Coder
    Join Date
    Jun 2002
    Location
    The Omega-3 system
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you whammy. That is a great tool for creating pop-ups.

    In my particular case however I really like John's way of creating what I needed with just one set of code and passing on the popurl and the settings.

    This may be possible with the tool you showed me but I am not a programmer so I wouldn't know how to alter it.

    So, John I appeal to you again, or someone, who can show me what extra code to add and where to add it in order to stop my two pop-ups from appearing half off the screen.

    Thanks all.

    Cheers!

    Phil

  • #10
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Actually I just did... check out the part where it centers the popup on the screen. Have you copied and pasted that and checked it out?
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #11
    New Coder
    Join Date
    Jun 2002
    Location
    The Omega-3 system
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, I checked out that pop-up generator and clicked the 'preview' button and it was great. If I just wanted one pop-up window then that would have solved everything but if you read through the posts in this thread you'll see that I am trying to open two different pages in two different pop-ups with different window sizes. So far John has helped me get there but now the windows are appearing half off the screen. That's the problem.

    If you can show me where I can do all of this with the pop-up generator code then sure I'll use that.

    By the way, surfing around that pop-up window generator site I was assaulted by pop-ups myself PLUS I got a VIRUS warning from my virus protection software. I am now having to sweep my hard drive for others.

    The pop-ups were annoying but understandable- the site is free.

    The virus.........???

  • #12
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Did you try the modified code that I posted above? It opens two separate popups at two different sizes... and I didn't modify it for my own health...
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #13
    New Coder
    Join Date
    Jun 2002
    Location
    The Omega-3 system
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok. I see what you did. Sorry. Like I said I am not a programmer and barely figure out what all this stuff means.

    Now to make myself more of a pain, what do I do if I want to use buttons instead of text links for the two pop-ups?

    Cheers!

  • #14
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <input type="button" value="My Button Name!!" onClick="PopUp(whatever)" />

    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #15
    New Coder
    Join Date
    Jun 2002
    Location
    The Omega-3 system
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok. Well I tried YOUR modified code. It won't work. Just to show you that I am using the same code as listed above I am going to cut and paste it below straight out of Front Page

    <script language="javascript" type="text/javascript">
    <!--
    function PopUp(PopUpUrl,thewidth,theheight){
    var ScreenWidth=window.screen.width;
    var ScreenHeight=window.screen.height;
    var movefromedge=0;
    placementx=(ScreenWidth/thewidth)-((thewidth)/2);
    placementy=(ScreenHeight/theheight)-((theheight+50)/2);
    WinPop=window.open(PopUpUrl,"","width="+thewidth+",height="+theheight+" ,toolbar=0,location=0,directories=0,status=0,scrol
    lbars=0,menubar=0,resizable=0,left="+placementx+",top="+placementy+",screenX="+placementx+",screenY= "+placementy+",");
    }
    // -->
    </script>

    <a href="java script:PopUp('http:/www.barbie.com',400,300)">Barbie</a><br />
    <a href="java script:PopUp('http:/www.yahoo.com',800,600)">Yahoo!</a><br />





    No pop-ups appear at all. Instead each click goes to a non-existant page in the full browser page.

    Now, obviously www.yahoo.com does exist so somewhere there lies a problem. I have no idea. I'm not a programmer.


  •  
    Page 1 of 3 123 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •