473,408 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

after prompting I got "unspecified error"

I have the following code in the event onbeforeunload

if ( typeof executingPostBack != 'undefined' && !executingPostBack )
event.returnValue = ""Warning: Modified data has not been saved."";

executingPostBack is a global variable.

I have another function for another event trying to access an object as
follows:

window.location.href = targetObj.href;

everything is OK, but it raises the "unspecified error" when I click
cancel in the popup confirmation window.

anyone gets experience of this ?

thank you very much!

Apr 10 '06 #1
6 5153
so*********@gmail.com wrote:
I have the following code in the event onbeforeunload

if ( typeof executingPostBack != 'undefined' && !executingPostBack )
event.returnValue = ""Warning: Modified data has not been saved."";

^^ ^^
String literals are to be delimited by only one <"> or <'> character.
PointedEars
Apr 10 '06 #2
VK

so*********@gmail.com wrote:
I have the following code in the event onbeforeunload

if ( typeof executingPostBack != 'undefined' && !executingPostBack )
event.returnValue = ""Warning: Modified data has not been saved."";

executingPostBack is a global variable.

I have another function for another event trying to access an object as
follows:

window.location.href = targetObj.href;

everything is OK, but it raises the "unspecified error" when I click
cancel in the popup confirmation window.


Not me: by my observations onbeforeupload handler works smoothly.
"Unspecified error" usually meand that you managed to twist the engine
totally for all 360deg, so it doesn't remember its name and the year
anymore :-)

This line make me suspitious:
window.location.href = targetObj.href;
-not by itself but because you call it "access an object". You are not
accessing an object, you are navigating away from the current page to
the targetObj.href location. If you have onbeforeunload confirmation
already pending for user interaction, add some more pending events...
add a bit of fantasy... I guess it is possible to produce "Unspecified
error". :-)

Could you narrow you problem to some minimum (but self-contained) code?

Apr 10 '06 #3
ooops~

sorry, that's a typo
ignore that, 'cause i am using some code-behind to output the script

Apr 10 '06 #4
thanks for your reply. but why if I click [OK] in the confirmation
window, everything works fine?

my code actually tends to do some hotkey stuffs:

I creates several functions for my links, for example:

function fndnn_ctr407_RelatedData_PageNav_CancelButtonKeyup (event)
{
var b =
document.getElementById('dnn_ctr407_RelatedData_Pa geNav_CancelButton');
Hotkey(event, b, false, false, true, 67);
}
if (document.addEventListener)
document.addEventListener('keyup',
fndnn_ctr407_RelatedData_PageNav_CancelButtonKeyup , true);
else
document.attachEvent('onkeyup',
fndnn_ctr407_RelatedData_PageNav_CancelButtonKeyup );

there are several other functions, ie. for Save button, etc.

they are all attached to the onkeyup event, and I also have an event
for onbeforeunload.

my hotkey function is as follows:

function Hotkey(event, targetObj, ctrlKey, shiftKey, altKey, keycode)
{
if (processing) return;

processing = true;

if (
targetObj
&& event.ctrlKey == ctrlKey
&& event.shiftKey == shiftKey
&& event.altKey == altKey
&& event.keyCode == keycode
)
{
// if we need to post back
if (targetObj.href && targetObj.href.indexOf('doPostBack')>0)
{
executingPostBack = true;
window.location.href = targetObj.href;
}
else if (targetObj.onclick)
{
targetObj.click();
}
else
{
window.location.href = targetObj.href;
}

}

processing = false;
}

When the user clicks [Add] button, I assumes the page is modified, then
I register the onbeforeunload event to prompt the user.
Everything works fine, but it fails when the user clicks [Cancel] in
the confirmation window. The error happens at that line trying to
access targetObj.

any idea?

Thanks

Apr 10 '06 #5
HaHa!

it works

after I use this :

var url = targetObj.href;
try
{
window.location.href = url;
}
catch (e)
{
// do nothing
}

Apr 10 '06 #6
so*********@gmail.com wrote:
it works

after I use this :

var url = targetObj.href;
try
{
window.location.href = url;
}
catch (e)
{
// do nothing
}


Note that this will break in IE < 5.0. Maybe you are looking for

window.location = url;

instead.
PointedEars
Apr 10 '06 #7

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

Similar topics

1
by: DRIZAII | last post by:
I am wondering if anyone has come across this problem. I have a huge VC6 project (C++ Win32 DLLs, .dsp, .dsw), and when I tried to open the project through Visual Studio .NET 2003, it offered to...
3
by: joseph | last post by:
When I perform "Copy Project" in VS.NET 2003 sometimes I got "Unspecified Error" error in a pop-up. My colleague also has this problem. Is it something to do with the network or to do with...
0
by: GaryB | last post by:
Using ADO (VB6),Access 2000, MDAC 2.8, under Win2K, if I simply run 3 computers simultaneously INSERTing a single record into a single table on the server PC (adoConn.Execute strSQL) at a rate of...
2
by: VB Programmer | last post by:
I created a ASP.NET app locally and it works great. Uploaded it to my server and I get this error when trying to view a page. Any ideas? Server Error in '/earlyalert3' Application....
10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
0
by: ratsekil via AccessMonster.com | last post by:
Pls Help ! "Unspecified error" ------------------------------------------------------------------------------ -- I'm using Windows Server 2003, making the webpages with ASP+Access(2000) ...
0
by: Jonathan | last post by:
Hi Everyone, I have a problem which I've been able to reproduce with a nice and small test ASP.NET web application. The page sets the window.onbeforeunload event so that we will get an Ok/Cancel...
0
by: fniles | last post by:
I am using VB.Net 2003 and MS Access database. Sometimes when I open the database, I got the error "Unspecified error" The application validate users, when it validates users, it reads from a...
1
by: SD007 | last post by:
I am using C#.Net 2005 and Access 2000 and I am getting an error called "Unspecified Error" at the time of execution of a query. Can anybody help me to solve this problem?
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.