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 3 of 3
  1. #1
    New Coder
    Join Date
    May 2006
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    showmodal window

    here is my code in javascript
    i am trying to popup a window from the script itself. my ultimate goal is to attain showModalDialog quality to the windowm . i could not replace open with showModalDialog. is there anyother way to attain this quality to my window? plz suggest me here. thanks
    Code:
    function firstPopup() {
       
    	myWin= open("", "displayWindow","titlebar=no,width=275,height=200,status=no,titlebar=no,toolbar=no,menubar=no,location=no,directories=no,alwaysRaised=yes,outerWidth=1,outerHeight =1,left=350,top=200");
    	
    	myWin.document.open();
    
    	myWin.document.write("<HTML>" );
    	
    	myWin.document.write(" <HEAD >");
        
    	myWin.document.write(" <style> .message {    position:absolute;    top:10px;	width:255px;	height:25px;	color: red;	border: solid rgb(0,127,164); border-left-style: hidden; border-right-style: hidden; border-bottom-style: hidden; /* orange */	background-color: white ; } .message #button{	position:relative;	color: black;  visibility: visible; background-color: white ; }  .button{ position:relative; 	color: black; 	border-width: 0px; 	border-style: solid; visibility: hidden;	background-color: lightblue;  }  #myButton { position: absolute;  right: 145px;  bottom: 35px;}  #cancelButton {    position: absolute;   right: 60px;    bottom: 35px;} </style> ");
    	
    	myWin.document.write(" <script language=\"javascript\" > var imp= null; function impor(){imp='norefresh';} ; function fcl(){  if(imp!='norefresh') {  opener.reFreshCurWindow(); }}  function func(s){ if(s==\"CONTINUE\"){opener.selectionofbutton(s);self.close();}else{opener.selectionofbutton(s);self.close();  }}function f1(){setInterval (\"window.focus()\",1)}; setTimeout('impor()',359999);</script> " );
    
    	myWin.document.write(" <TITLE> CCH WALL STREET - CRN</TITLE> </HEAD>");
    
        myWin.document.write("<BODY bgcolor=white onUnload=\"fcl()\" onBlur=\"window.focus()\" onload=\"f1()\" ><form name=\"bobz\" method=\"get\" action=\"\">  <div class=\"message\"> <div id=\"button\" class=\"button\" > <h4> your CCH Research Network session will time-out in a few minutes due to inactivity. If you would like to continue your research, click the appropriate button below     <h4> </div> </div>	<div id=\"myButton\"> <input type=\"button\"  name=\"CONTINUE\" value=\"CONTINUE\" onClick=\"impor(this.name) ,func(this.name)\"></div> <div id=\"cancelButton\"> <input type=\"button\"  name=\"LOG OFF\" value=\"LOG OFF\" onClick=\"return func(this.name)\"></div></form>");
    
    	myWin.document.write("</BODY>")
    
    	myWin.document.write("</HTML>")
    	
    	myWin.document.close();
    	
    	setTimeout ('myWin.close()', 360000); 
    	lastwin = setTimeout ("finalwindow()",360000);
     
    	
    }
    regards.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Well I wrote this
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>showModelDialog</title>
    <script type="text/javascript">
    function loadit(url,wid,hgt)
    {
    	var sw = (screen.width - wid) / 2;
    	var sh = (screen.height - hgt) / 2;
    	if (window.showModalDialog)
    	{
    		win = window.showModalDialog(url,'dialogHeight='+hgt+',dialogWidth='+wid+'');
    	} 
    	else
    	{
    		win = window.open(url,'win','height='+hgt+',width='+wid+',top='+sh+',left='+sw+'');
    	}
    }
    </script>
    </head>
    
    <body>
    <a href="http://www.yahoo.com" onClick="loadit(this.href,400,400);return false">yahoo</a>
    </body>
    </html>
    It will use showModalDialog if the browser supports it, if not, it will use window.open but your problem seems to be that you have used the open() function twice in succession. Get rid of the part in bold here
    Code:
    	myWin= open("", "displayWindow","titlebar=no,width=275,height=200,status=no,titlebar=no,toolbar=no,menubar=no,location=no,directories=no,alwaysRaised=yes,outerWidth=1,outerHeight =1,left=350,top=200");
    	
    	myWin.document.open();
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New Coder
    Join Date
    May 2006
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    not a solution

    u have not understood my question properly.
    regards.


  •  

    Posting Permissions

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