Window.Location Question

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

LVL 1
hefterrAsked:
Who is Participating?
 
leakim971PluritechnicianCommented:
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
 
_agx_Commented:
<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
 
_agx_Commented:
Too slow ;-)
0
 
leakim971PluritechnicianCommented:
;-))
0
 
hefterrAuthor Commented:
Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.