1,105,636 Community Members

window.location

Member Avatar
nikita.chandra
Junior Poster in Training
69 posts since Aug 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Unable to redirect to the page using window.location of javascript for the code given below

<script language="javascript">
function confirmation() {

    
	var answer = confirm("Do you want to add more Bussess?")
	if (answer){


	   }
	else{
		alert("Thanks for using Bus Entry form")
                 window.location = "adminHomePage.jsp"

	}
     }

Anyone can tell me the reason for this.?
i have asready tried full path of the file

Member Avatar
Graphix
Posting Pro in Training
410 posts since Aug 2009
Reputation Points: 68 [?]
Q&As Helped to Solve: 75 [?]
Skill Endorsements: 0 [?]
 
0
 

1. You neglected to end each line with a ;
2. It is window.location.href = 'URL';
3. Your indenting is a bit weird, see the following URL on how to code properly: http://www.webdevproject.com/guides/programming/guide2.html

~G

Member Avatar
Taywin
Posting Maven
2,632 posts since Apr 2010
Reputation Points: 134 [?]
Q&As Helped to Solve: 378 [?]
Skill Endorsements: 17 [?]
 
0
 

1. You neglected to end each line with a ;

You don't need to end it with ';' anymore unless you are trying to code it in 1 line. :)

Member Avatar
Graphix
Posting Pro in Training
410 posts since Aug 2009
Reputation Points: 68 [?]
Q&As Helped to Solve: 75 [?]
Skill Endorsements: 0 [?]
 
0
 

Which he is not on line 11 + 12

But yes you are right, you can code in one line:

if (x == 0) { x++ }

But doens't this look nicer :)

if (x == 0) { x++; }

~G

Member Avatar
Airshow
WiFi Lounge Lizard
2,798 posts since Apr 2009
Reputation Points: 333 [?]
Q&As Helped to Solve: 393 [?]
Skill Endorsements: 11 [?]
Team Colleague
 
0
 

Nikita,

If you want to build/manipulate Locations then you might like to try my LOCATION constructor:
http://www.daniweb.com/code/snippet217388.html

It is quite well documented and probably overkill for what you want but maybe useful to remember for the future.

Airshow

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article