SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2010
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to login in same or other window with controlled size

    Code:
    <?xml version="1.0" encoding="[CONTENT_ENCODING/]"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="[LANG_CODE/]" lang="[LANG_CODE/]" dir="[BASE_DIRECTION/]">
    
    <head>
    	<meta http-equiv="Content-Type" content="[CONTENT_TYPE/]" />
    	<title>Micro Customer Care</title>
    	<style type="text/css">
    		body {
    			padding:0;
    			margin:0;
    		}
    	</style>
    	[STYLE_SHEETS/]
    	<!--[if lt IE 7]>
    		<link rel="stylesheet" type="text/css" href="css/ie5-6.css"/>
    	<![endif]-->
    	<script src="js/chat.js" type="text/javascript" charset="UTF-8"></script>
    	<script src="js/lang/[LANG_CODE/].js" type="text/javascript" charset="UTF-8"></script>
    	<script src="js/config.js" type="text/javascript" charset="UTF-8"></script>
    	<script type="text/javascript">
    		// <![CDATA[
    		
    		function OnSubmit()
    {	//alert("Ankit");
        var x=document.forms["myForm"]["userName"].value;
       if (x==null || x=="")
      {
      alert("User name must be filled out");
      return false;
      }
      var x=document.forms["myForm"]["email"].value;
       if (x==null || x=="")
      {
      alert("E-mail must be filled out");
      return false;
      }
    	var x=document.forms["myForm"]["email"].value;
    var atpos=x.indexOf("@");
    var dotpos=x.lastIndexOf(".");
    if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
      {
      alert("Not a valid e-mail address");
      return false;
      }
        
        document.getElementById('loginForm').action = "formData.php",// Second target
    	document.getElementById('loginForm').target = "_self";	 // Open in a iframe
    	document.getElementById('loginForm').submit();
    	document.getElementById('loginForm').action = "[LOGIN_URL/]"// Second target
    	document.getElementById('loginForm').target = "_self";	 // Open in a iframe
    	document.getElementById('loginForm').submit();
    	window.open("[LOGIN_URL/]","_blank","width=400, height=400");
    	
    	
    	return true;
    }
    			function initializeLoginPage() {
    				document.getElementById('userNameField').focus();
    				if(!ajaxChat.isCookieEnabled()) {
    					var node = document.createElement('div');
    					var text = document.createTextNode(ajaxChatLang['errorCookiesRequired']);
    					node.appendChild(text);
    					document.getElementById('errorContainer').appendChild(node);
    				}
    			}
    			
    			ajaxChatConfig.sessionName = '[SESSION_NAME/]';
    			ajaxChatConfig.cookieExpiration = parseInt('[COOKIE_EXPIRATION/]');
    			ajaxChatConfig.cookiePath = '[COOKIE_PATH/]';
    			ajaxChatConfig.cookieDomain = '[COOKIE_DOMAIN/]';
    			ajaxChatConfig.cookieSecure = '[COOKIE_SECURE/]';
    
    			ajaxChat.init(ajaxChatConfig, ajaxChatLang, true, true, false);
    		// ]]>
    	</script>
    </head>
    
    <body onload="initializeLoginPage();">
    	<div id="loginContent">
    		<div id="loginHeadlineContainer">
    			<h1>Micro Customer Care</h1>
    		</div>
    			<form id="loginForm" name="myForm" action="[LOGIN_URL/]" method="post" enctype="application/x-www-form-urlencoded" >
    				<div id="loginFormContainer">
    					<!--<input type="hidden" name="login" id="loginField" value="login"/>
    					<input type="hidden" name="redirect" id="redirectField" value="[REDIRECT_URL/]"/>-->
    					<div><label for="userNameField">[LANG]userName[/LANG]:</label><br />
    					<input type="text" name="userName" id="userNameField" maxlength="[USER_NAME_MAX_LENGTH/]"/></div>
    					<div><label for="passwordField">Email:</label><br />
    					<input type="text" name="email" id="passwordField"/></div>
    					<!--<div><label for="channelField">[LANG]channel[/LANG]:</label><br />
    					<select name="channelName" id="channelField">[CHANNEL_OPTIONS/]</select></div>
    					<div><label for="languageSelection">[LANG]language[/LANG]:</label><br />
    					<select id="languageSelection" name="lang" onchange="ajaxChat.switchLanguage(this.value);">[LANGUAGE_OPTIONS/]</select></div>-->
    					<div><input type="submit" value="[LANG]login[/LANG]" name="button1" id="loginButton"  onclick="return OnSubmit();"/></div>
    					<!--<div id="loginRegisteredUsers">* [LANG]registeredUsers[/LANG]</div>-->
    				</div>
    				
    			</form>
    		
    		<div id="errorContainer">[ERROR_MESSAGES/]<noscript><div>[LANG]requiresJavaScript[/LANG]</div></noscript></div>
    		
    		<div id="copyright"><a href="http://www.microtechnologies.net/">Micro</a> &copy; <a href="http://www.microtechnologies.net/">Microtechnologies.net</a></div>
    	</div>
    	<div style="visibility:hidden">
         <iframe NAME="iframe2" WIDTH="40" HEIGHT="40" ></iframe>
    	</div>
    </body>
    
    </html>

    HI friends....
    I have a login page. I want when user click on Login button it redirects to same or another window but with controlled size i.e. it should be pop up of user home page after login.
    I used
    Code:
    window.open("[LOGIN_URL/]","_blank","width=400, height=400");
    for creating pop-up but problem is that pop-up not displays user's home page instead it displays login page again(which is not required).
    Can I any one tell me how to create a pop-up which displays user's home page???
    Please help me....
    Thanks in advance.....

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Location
    South Africa
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    window.open("[LOGIN_URL/]","_blank","width=400, height=400");
    shouldn't it be:

    window.open("[HOMEPAGE_URL/]","_blank","width=400, height=400");

    ====
    new window must display the homepage and not the login page
    ====

    specify the url of the new window to be the url of the homepage


Bookmarks

Posting Permissions

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