Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Javascript popup

  • 24-03-2003 7:31pm
    #1
    Closed Accounts Posts: 1,819 ✭✭✭


    Could anyone take a look at this javascript and tell me why it's not working in Opera, but works fine in IE and Phoenix.
    <SCRIPT LANGUAGE="JavaScript"> 
    var mypopup=null;
    function popup(URL, winW, winH) 
    { 
         if ( mypopup && !mypopup.closed )
        {
            mypopup.close();
        }
        mypopup = window.open(URL, "Pic", 'scrollbars=0, menubar=0, resizable=0, titlebar=0, toolbar=0, status=0, left=0, top=0, width=' + winW + ', height=' + winH);
      mypopup.document.bgColor="black";
      mypopup.document.write('<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>');
      mypopup.document.write('<img src="' + URL + '" border="0">');
      mypopup.document.write('</body>'); 
    } 
    </SCRIPT> 
    

    Here is where i make use of the popup function:
    <a href="javascript: popup('./images/gallery/1.jpg','640','480')">
    


    Cheers,

    Killian


Comments

  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Perhaps one of the attributes in the window.open function isn't supported by Opera? Try removing them to see if I'm right, and if I am, add them back in one at a time to see which one it is.

    adam


  • Registered Users, Registered Users 2 Posts: 944 ✭✭✭nahdoic


    I'm not actually being smart, but do you have pop ups disabled in opera? I know it's my favourite feature of opera.


  • Closed Accounts Posts: 1,819 ✭✭✭K!LL!@N


    Cheers Dahamsta, I'll try removing the features and see what happens.

    Nahdoic, you're not being smart. That was the first thing i tried but didn't work. Doesn't currently work with opera 6 or opera 7.

    I'd just like to get it working with the 3 main browsers.

    Anymore suggestions welcome.

    Cheers,

    Killian


  • Registered Users, Registered Users 2 Posts: 944 ✭✭✭nahdoic


    what you have there doesn't work in opera or msie for me, why did you put spaces in?

    [edit: ah you put spaces in because it wasn't appearing right posting in boards. but your javascript code is working for me in opera 6]
    <a href="javascript:popup('./images/gallery/1.jpg','640','480')">
    

    works in opera 6 and msie for me


  • Closed Accounts Posts: 1,819 ✭✭✭K!LL!@N


    Originally posted by nahdoic
    what you have there doesn't work in opera or msie for me, but

    <a href="javascript:popup('./images/gallery/1.jpg','640','480')">
    

    works in opera 6 and msie for me


    Sorry, i changed that just so the smilie face wouldn't appear.
    I'm actually using what you have written, sorry for the confusion.

    Killian


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 944 ✭✭✭nahdoic


    right. well it's working perfectly for me in opera 6.

    do you have javascript enabled, and are you sure you don't have pop up windows disabled?


  • Registered Users, Registered Users 2 Posts: 944 ✭✭✭nahdoic


    or maybe it's another part of your website that opera is having the gripe with.


  • Closed Accounts Posts: 1,819 ✭✭✭K!LL!@N


    Gah, i've tried loads of things.
    Nothing seems to be working.
    I've made sure that javascript is enabled and the popups are to be accepted in Opera but still no joy.
    So i've put up just a simple page with the code.
    It works in IE and Phoenix.
    Still not working in Opera.
    If you wouldn't mind taking a look at the page and see if works.

    Cheers,

    Killian


  • Registered Users, Registered Users 2 Posts: 944 ✭✭✭nahdoic


    no ... that page isn't working ... now that's weird.


  • Registered Users, Registered Users 2 Posts: 944 ✭✭✭nahdoic


    this is working in opera 6
    <SCRIPT LANGUAGE="JavaScript">
    var mypopup=null;
    function popup(URL, winW, winH)
    {
         if ( mypopup && !mypopup.closed )
        {
            mypopup.close();
        }
        mypopup = window.open(URL, "Pic", 'scrollbars=0, menubar=0, resizable=0, titlebar=0, toolbar=0, status=0, left=0, top=0, width=' + winW + ', height=' + winH);
      mypopup.document.bgColor="black";
      mypopup.document.write('<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>');
      mypopup.document.write('<img src="' + URL + '" border="0">');
      mypopup.document.write('</body>');
    }
    </SCRIPT>
    

    this is not. not sure why? spot the reason anyone?
    <SCRIPT LANGUAGE="JavaScript"> 
    var mypopup=null;
    function popup(URL, winW, winH) 
    { 
      if ( mypopup && !mypopup.closed )
    __{
    _____mypopup.close();
    __}
    
    __mypopup = window.open(URL, "Pic", 'scrollbars=0, menubar=0, resizable=0, toolbar=0, status=0, left=0, top=0, width=' + winW + ', height=' + winH);
      mypopup.document.bgColor="black";
      mypopup.document.write('<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>');
      mypopup.document.write('<img src="' + URL + '" border="0">');
      mypopup.document.write('</body>'); 
    } 
    </SCRIPT> 
    


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 944 ✭✭✭nahdoic


    this is turning out to be very strange. I'm not sure where those underline scores came from, in the 'code that wasn't working', but when I used that code and removed those lines, then that code was working in opera. oh i give up. use target=_blank instead ;)


  • Registered Users, Registered Users 2 Posts: 944 ✭✭✭nahdoic


    this is the strangest error I think I've ever come across. i took your page straight from the web. saved it to my hd. tried it out, it doesn't work.

    I then removed those spaces that came up when I posted in boards, and it worked.

    I then undo'ed the removal of those spaces, and again it wasn't working.

    you seem to have 'special spaces' in your code, somehow, someway. is that even possible?


  • Registered Users, Registered Users 2 Posts: 944 ✭✭✭nahdoic


    I narrowed it down and it's this one line

    this doesn't work
      if ( mypopup && !mypopup.closed )
    __{
    

    this works
      if ( mypopup && !mypopup.closed )
      {
    

    and as I am posting this, they both look identical in this box. there's some sort of weird spaces in your code, perhaps it's from uploading ascii mode or binary, when you should have used one or the other. I didn't know you could have 'weird' spaces that break your code.


  • Closed Accounts Posts: 1,819 ✭✭✭K!LL!@N


    Yeah, i got those line things earlier when i pasted in the code, but i removed them.

    I'm editing the code in dreamweaver html editor, perhaps i should edit it in notepad and see what happens.

    I'm going to wait til morning to do that though.

    Thanks for taking a look though, much appreciated.

    Hoping it's not melting your brain as much as it is mine.

    Killian


  • Closed Accounts Posts: 1,819 ✭✭✭K!LL!@N


    Originally posted by nahdoic
    I narrowed it down and it's this one line

    this doesn't work

      if ( mypopup && !mypopup.closed )
    __{
    

    this works
      if ( mypopup && !mypopup.closed )
      {
    

    and as I am posting this, they both look identical in this box. there's some sort of weird spaces in your code, perhaps it's from uploading ascii mode or binary, when you should have used one or the other. I didn't know you could have 'weird' spaces that break your code.


    Weird invisible spaces, the ultimate code killer. :D

    Thanks again for going to so much trouble.

    Perhaps i should try and fix it now, after you've gone to so much trouble.

    Killian


  • Closed Accounts Posts: 1,819 ✭✭✭K!LL!@N


    Ok, that was just too weird!

    Whatever those spaces were, they were causing the problem.
    I've just edited the code in notepad instead of dreamweaver and it's now working.

    Cheers nahdoic! :D

    Killian


Advertisement