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
  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    Los Angeles
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Mozilla Layer not updating, MAC IE 5.1 Crash

    Hello,

    I am trying to do something that would seem simple, but its taken my a couple hours of messing with variations of code that never seem to work.

    The below code is for a pop up to close itself and update a parent layer. Works fine in PC IE 5.5+, but not in mozilla 1.4. On MAC 5.1, the update just crashes the browser altogether, parent and child windows. But works fine on MAC IE 4.5!

    Here's my code, parent page code:
    Code:
    <html>
    <head>
    	<title>Test Pop Up - Parent</title>
    	
    <script language="JavaScript1.2" type="text/javascript">	
    	function winPopUp(winurl,winname,winprops) {
        	winpopup = open(winurl,winname,"width=400,height=400,scrollbars=auto,resizable=yes");
        	winpopup.top.focus();
        }
    	
    	function updateContents(div_tag,update_value){
    		if (document.all){
    			document.all(div_tag).innerHTML = update_value;
    		}else if (document.getElementById){
    			document.getElementById(div_tag).innerHtml = update_value;
    		}
    	}
    	
    	function updateLayer() {
    		updateContents("test_layer","this is test text<br><br>");
    	}
    </script>
    
    </head>
    <body bgcolor="#ffffff">
    <h1>Test pop up Parent</h1>
    <div style="position: relative;" id="test_layer"></div>
    <br><br>
    <a href="javascript:winPopUp('pop_up.asp','pop_up','');">Pop Up</a>
    </body>
    </html>
    Pop Up page code:
    Code:
    <html>
    <head>
    	<title>Test Pop Up</title>
    	
    <script language="JavaScript1.2" type="text/javascript">
    	function closeSelfAndUpdateParentLayer() {
    		if (window.opener != null) {
    			self.close();
    			window.opener.updateLayer();
    		}
    		//alert("foo");
    		window.close();
    	}
    </script>
    
    </head>
    <body bgcolor="#ffffff">
    <h1>Test pop up submit</h1>
    <form action="pop_up.html" method=post name=testForm>
    <input type=radio name="test" value="test">Test
    <br>
    <a href="javascript:closeSelfAndUpdateParentLayer();"><img src="submit.gif" border=0></a>
    </form>
    
    
    </body>
    </html>
    Thanks in advance.

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Surrey, UK
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try changing some parts:
    <a onclick="closeSelfAndUpdateParentLayer();return false" href="#">

    and:
    <a onclick="winPopUp('pop_up.asp','pop_up','');return false" href="#">

    and:
    function closeSelfAndUpdateParentLayer() {
    if (window.opener != null) {
    window.opener.updateLayer();
    self.close();

    }
    //alert("foo");
    window.close();
    }

  • #3
    New Coder
    Join Date
    Jul 2002
    Location
    Los Angeles
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks ahosang. That solved the MAC IE 5.1 crash. However, in Mozilla 1.4, the parent layer is still NOT updating. Urgh. The mozilla javascript console doesn't have any errors and my debugger doesn't debug JS very well.

  • #4
    New Coder
    Join Date
    Jul 2002
    Location
    Los Angeles
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts
    WTF@@@##$#!!!!!

    I figured out the Mozilla 1.4 bug and it works in Firebird 0.7 too. I went to this post:
    getting a link to change a peice of text...

    Took the function there and apply it to my document.getElementById area. Bam! works, i had return false in that section, but it didn't work. But calling another function with a return false works.

    I am not sure as to why that logic works, but I am moving on now.

    Thanks to all and hopefully the code will help some ppl out.

    Parent HTML code:
    Code:
    <html>
    <head>
    	<title>Test Pop Up - Parent</title>
    	
    <script language="JavaScript1.2" type="text/javascript">	
    	function winPopUp(winurl,winname,winprops) {
        	winpopup = open(winurl,winname,"width=400,height=400,scrollbars=auto,resizable=yes");
        	winpopup.top.focus();
        }
    	
    	function updateContents(div_tag,update_value){
    		if (document.all){
    			document.all(div_tag).innerHTML = update_value;
    		}else if (document.getElementById){
    			changeLayerText(div_tag, update_value)
    			//document.getElementById(div_tag).innerHtml = update_value;
    		}
    		return false;
    	}
    	
    	function updateLayer() {
    		updateContents("test_layer","this is test text<br><br>");
    	}
    	
    	function changeLayerText(div_tag,txt){
    		document.getElementById(div_tag).innerHTML=txt;
    		return false;
    	}
    </script>
    
    </head>
    <body bgcolor="#ffffff">
    <h1>Test pop up Parent</h1>
    <div style="position: relative;" id="test_layer"></div>
    <br><br>
    <a href="javascript:winPopUp('pop_up.asp','pop_up','');">Pop Up</a>
    </body>
    </html>
    Child Pop Up HTML code:
    Code:
    <html>
    <head>
    	<title>Test Pop Up</title>
    	
    <script language="JavaScript1.2" type="text/javascript">
    	function closeSelfAndUpdateParentLayer() {
    		if (window.opener != null) {
    			window.opener.updateLayer();
    		}
    		self.close();
    	}
    </script>
    
    </head>
    <body bgcolor="#ffffff">
    <h1>Test pop up submit</h1>
    <form action="pop_up.html" method=post name=testForm>
    <input type=radio name="test" value="test">Test
    <br>
    <a href="#" onclick="javascript:closeSelfAndUpdateParentLayer();return false;"><img src="submit.gif" border=0></a>
    </form>
    </body>
    </html>


  •  

    Posting Permissions

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