472,353 Members | 1,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

Javascript location.href not working

Here is my code created when a page loads the first time:

string jScript =

var pop = false;
var ans =
ans =
confirm('Are you sure you want to Cancel and lose any
if (ans)


parent.location.href = 'OrderMisc.aspx';

if ( !IsStartupScriptRegistered
("CancelPage") )
("CancelPage", jScript);

("onclick","javascript: pop=true;CancelPage();");
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++

Code is called correctly when the Cancel button is
pressed because I get the confirmation box, I click yes
and I get the alert box from the code, then the page
reloads without redirecting to 'OrderMaint.aspx'.

OrderMaint.aspx is spelled correctly and in the same
directory so I'm not sure why it's not taking me there.

Any ideas?

Nov 18 '05 #1
1 2296

If button is asp.net server control or HTML submit button you need to
cancel it default behavior by cancel event bubbling and returning false
from your javascript function:

window.event.returnValue = false;
window.event.cancelBubble = true;
Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: splatter | last post by:
Hey all, I'm trying to get a java bookmark to work from my browsers address field which is supposed to send a prefix + reload the current page...
by: DCB | last post by:
Hello. I have an easy question, likely, that has me in a headspin. I have an include file to a frames based site that basically forces frames on...
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net...
by: e | last post by:
I've been having an extremely difficult time finding an answer to this in IE / js groups, so I thought I'd try here. I've got an aspx page that...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.