Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Window.Location Question

Posted on 2011-05-11
5
Medium Priority
?
260 Views
Last Modified: 2012-05-11
Hi,
I am a Javascript newbie so please keep that in mind.

Please see small script below.  I am using a link (associated with the deletion of a row in a table) so I have a small script to ask if the user id sure.  The confirm box opens but if OK is selected, nothing happens.

Your expertise would be appreciated.

hefterr
<script type="text/javascript">
function show_confirm(addrno)
{
	var myurl='http://www.google.com?Type=S&amp;Action=D&amp;' + addrno;
	var r=confirm("Are you sure you want to remove this list?");
	if (r==true) {
	 window.location(myurl)
		
	}
}
</script>

Open in new window

0
Comment
Question by:hefterr
  • 2
  • 2
5 Comments
 
LVL 83

Accepted Solution

by:
leakim971 earned 1000 total points
ID: 35742536
Replace line 7 : window.location(myurl)
By : window.location = myurl;


<script type="text/javascript">
function show_confirm(addrno)
{
	var myurl='http://www.google.com?Type=S&amp;Action=D&amp;' + addrno;
	if(confirm("Are you sure you want to remove this list?")) {
	     location.href = myurl
	}
}
</script>

Open in new window

0
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 1000 total points
ID: 35742544
<script type="text/javascript">
function show_confirm(addrno)
{
      var myurl='http://www.google.com?Type=S&Action=D&' + addrno;
      var wasConfirmed=confirm("Are you sure you want to remove this list?");
      if (wasConfirmed) {
       window.location.href = myurl;
            
      }
}
</script>
0
 
LVL 52

Expert Comment

by:_agx_
ID: 35742546
Too slow ;-)
0
 
LVL 83

Expert Comment

by:leakim971
ID: 35742558
;-))
0
 
LVL 1

Author Closing Comment

by:hefterr
ID: 35746903
Thanks!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question