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 1 of 1
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Posts
    184
    Thanks
    140
    Thanked 0 Times in 0 Posts

    Storing The Date into a Var From a Popup Date Picker

    Hello,

    I really need your help with one.

    How can I use the following code below to save the date from my popup window datepicker back into a var and relay it back onto its parent page?

    I can't seem to figure this out:

    Code:
    <html>
    
    
    
    <head>
    
    <script>
    	
    	function open_cal() {
    	
    
      var str_html	= 	""
      				+	"<!DOCTYPE html>\n"
    				+	"<html lang=\"en\">\n"
    				+	"<head>\n"
    				+	"<meta charset=\"utf-8\">\n"
    				+	"<title>CALENDAR</title>\n"
    				+	"<link href=\"jq/jquery-ui.css\" rel=\"stylesheet\" type=\"text/css\">\n"
    				+	"<script src=\"jq/jquery.min.js\" type=\"text/javascript\"></" + "script>\n" 
    				+	"<script src=\"jq/jquery-ui.min.js\" type=\"text/javascript\"></" + "script>\n"
    				+	"<script src=\"jq/datepicker.js\" type=\"text/javascript\"></" + "script>\n"
    				+	"</head>\n"
    				+	"<body>\n"
    				+	"<div id=\"text\" style=\"font: bold 10pt Tahoma\">Enter Approval Date:</div>\n"
      				+	"<div id=\"datepicker\"></div>\n"
      				+	"</body>\n"
      				+	"</html>"
      				
    var j = window.open("","CALENDAR","width=200,height=250,status=no,resizable=yes,top=200,left=200")
    	j.opener = self;
    	j.document.write(str_html);
    }
    
    
    </script>	
    	
    
    		
    </head>
    
    <body>
    
    <input onclick="open_cal()" type="button" value="Open" name="B1">
    
    
    </body>
    
    </html>
    Datepicker.js:
    Code:
    $(function() {
    	
    		$( "#datepicker" ).datepicker({ 
    		
    		dateFormat: 'dd/mm/yy',
    		
    		onSelect: function(dateText, inst) { 
    		alert(dateText)
    		window.close()
    		
    		} 
    		
    		})
    		
    		
    		
    		
    });
    Any help with this is greatly and mostly appreciated.

    Thanks in advance,

    Cheers,

    J
    Last edited by jason_kelly; 03-22-2012 at 02:18 AM.


 

Posting Permissions

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