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.
Results 1 to 4 of 4

Thread: Popup window

  1. #1
    Regular Coder
    Join Date
    Jan 2008
    Posts
    334
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Popup window

    Code:
    <script type="text/javascript">
    var newwindow;
    function poptastic(url)
    {
    	newwindow=window.open(url,'/controls/chat.php','height=400,width=700','resizable=no, scrolling=no');
    	if (window.focus) {newwindow.focus()}
    
    }
    </script>
    Code:
    <a href=\"javascript:poptastic('/controls/chat.php?msg_id=".$msg['msg_id']."');\" title='User ID: ".$msg['user_id']."'>
    This script I found is having two problems. One is that its not working at all in IE7. And the second problem was even though the resizeable is set to no the window is still resizeable. How do I fix these problems?

    And as a side question. With javascript how would I have Javascript check my database for new submission and then if there were new submission automatically show the new submissions on the page without you having to refresh?

    Or is it the other way around? Because I know PHP, would you have just like a function to check the variable that is heading the data and allow it to automatically display it when something new is entered?

    The reason why I'm wondering is because I'm working on a chat right now and the way I'm doing it now is having to put the chat inside of a iframe and having it to refresh the page that the chat is on every so often to show the message. I would really like to take it out of the iframe it have the chat on the same page that you are on to enter your message into the chat.

    Thanks,
    Jon W
    Last edited by Jon W; 03-21-2009 at 11:10 AM.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,917
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Remove the space in

    'resizable=no, scrolling=no'

    to read

    'resizable=no,scrolling=no'


    JavaScript is purely a client-side language, and unless used with an Ajax call has no capability to read from or write to a file (except a cookie), access a database or the client's operating system, or alter the default behaviour of the browser.

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

  • Users who have thanked Philip M for this post:

    Jacquesgroen (03-21-2009)

  • #3
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks Philip. Im new here and the first post I read, i discover something that will be of great use to me. Cant wait to check out the rest of this forum

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,157
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Your JavaScript code is WRONG!

    There are ONLY THREE arguments to window.open( ) and you are trying to use 4. No wonder IE7 barfs on your feet.
    Code:
    <script type="text/javascript">
    var newwindow;
    function poptastic(url)
    {
    	newwindow=window.open(
               url,
               '/controls/chat.php',
               'height=400,width=700,resizable=no,scrolling=no');
    	if (window.focus) {newwindow.focus()}
    
    }
    </script>
    Note that this also explains why your window remains resizable in the other browsers! THEY are simply ignoring the 4th argument whereas IE7 is (somewhat legitimately) rejecting the bad code completely.


  •  

    Posting Permissions

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