www.webdeveloper.com
Results 1 to 3 of 3

Thread: window.location firefox problem

  1. #1
    Join Date
    Oct 2009
    Posts
    9

    window.location firefox problem

    Hi,

    I have written the following small code for login page.

    The problem is that it perfectly works in IE6/7/8 versions but it doesn't work in Firefox browser.

    the strange part is the

    1) when i kept break point at " url = "../index.html";" and debug it it perfectly navigated in firefox too. but it didn't worked when i removed breakpoint.

    2) another strange thing is that, I removed the whole ajax part and placed directly (without validation the credentials, i mean without cgi call) the following lines of code

    url = "../index.html";
    setTimeout( function(){
    window.location=url;
    },0);
    it worked perfectly in firefox.

    I didn't understand the problem here.

    please any body can help me.

    HTML Code:
    <html><head>
    </head><body>
    <div class="global-container">
    		
    	<div class="clearfix" id="content">
    		<div style="margin: 180px 0px 0px 400px; width: 350px;">
    			<div style="text-align: center;">
    			</div>
    		</div>
    		<div style="margin: 10px 0px 0px 400px; width: 350px;" class="section float-left">
    			<div class="section-header">
    				<h1>LOGIN</h1>
    			</div>
    			<div class="clearfix section-body">
    				<form id="LoginForm" action="" method="get">
    				<div class="clearfix config-field-container">
    					<div class="fieldset ">
    						<div class="inner clearfix">
    							<div style="width: 330px;" class="float-left ">
    								<div class="field-block clearfix">
    									<label style="width: 100px;" class="inline float-left" for="name">User Name:</label>
    									<input class="config-textbox float-left" id="name" name="name">
    								</div>
    								<div class="field-block clearfix">
    									<label style="width: 100px;" class="inline float-left" for="password">Password:</label>
    									<input type="password" class="config-textbox float-left" id="password" name="password">
    								</div>
    								<div class="field-block clearfix">
    									<div style="margin: 5px 5px 5px 90px;" class="field-block clearfix float-left">
    										<input type="Reset" id="Reset" name="Reset">
    										<input type="submit" value="Login" id="Login" name="Login">
    									</div>
    								</div>
    							</div>
    						</div>
    					</div>
    				</div>
    				</form>
    			</div>
    		</div>
    	</div>
    </div>
    <script type="text/javascript">
    
    	var loginFun=function(){
    	
    		new Ajax.Request('../../cgi-bin/webagent.cgi?get-user-level', {
    	       asynchronous : false,
    	       evalJSON : 'force',
    	       method : 'POST',
    	       parameters : { name : document.getElementById("name").value, password: document.getElementById("password").value },
    	       onSuccess : function(transport) {
    				var data = transport.responseText;
    				if(data == -1){
    		             alert("Invalid Login");
    		             return;
    		        }
    		        sessvars.ptc = {userName: document.getElementById("name").value,userLevel:parseInt(data,10)}
    		        url = "../index.html";
    			    setTimeout( function(){
    				   window.location=url;
    			    },0);
    				 
    
    	       },
    	       onFaliure : function() {
    	                alert("Failed to get the Configuration update information");
    	       }
    		});
    	};
    
    	document.observe('dom:loaded', function() {
    		
    		$('Login').observe('click', loginFun);
    	});
    
    	$('name').focus();
    
    </script>
    </body></html>

  2. #2
    Join Date
    Oct 2006
    Posts
    939
    Oh o, whats this "$"
    That looks like a jquery thing

  3. #3
    Join Date
    Oct 2009
    Posts
    9
    I used prototype

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles