Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delay load

Status
Not open for further replies.

mthrawn

Programmer
Aug 17, 2000
42
GB
I want to stop a page from loading from the window_onload function, and then allow it to restart. Is there a way of doing this without refreshing the page as that would cause an infinite loop.

Matt
matt@tubedale.co.uk
I'm a mathematician/ computer programmer. My main interests lie in decision mathematics and web development although I am thoroughly capable in most areas of maths as well as many other forms of software development.
 
if you explain why you want to do this, i may be able to help you better jared@aauser.com
 
I have an ASP page, in which there is a Microsoft ActiveX Date and Time Picker. I want the window to load up with the object defaulting to the current date. I have used the following code to achieve this.

function window_onload()
{
var q=new Date();

var d=q.getDate();
var m=q.getMonth()+1;
var y=q.getYear();

thisForm.DTPicker1.Day=d;
thisForm.DTPicker1.Month=m;
thisForm.DTPicker1.Year=y;

thisForm.DTPicker2.Day=d;
thisForm.DTPicker2.Month=m;
thisForm.DTPicker2.Year=y;
}

However, when I open the page I occasionally (but not often) recieve the following error message:

"A date was specified that does not fall within the MinDate and MaxDate properties."

I have checked the MinDate and MaxDate properties which are set to '01/01/1601' and '31/12/9999' respectively.
As part of the debugging process, I have tried outputting the values to a window.alert, which freezes the page loading. When this process was followed, it was found that the page worked properly every time.
Then I tried writing values to a file as shown:
function window_onload()
{
var q=new Date();
d=q.getDate();
m=q.getMonth()+1;
y=q.getYear();

var f,fso;
fso=new ActiveXObject("Scripting.FileSystemObject");
f=fso.CreateTextFile("l:\\testDate.txt",true);
f.WriteLine("date = "+d+", month = "+m+", year = "+y);

thisForm.DTPicker1.Day=d;
f.WriteLine("DTPicker1.Day = "+thisForm.DTPicker1.Day);

thisForm.DTPicker1.Month=m;
f.WriteLine("DTPicker1.Month = "+thisForm.DTPicker1.Month);

thisForm.DTPicker1.Year=y;
f.WriteLine("DTPicker1.Year = "+thisForm.DTPicker1.Year);

thisForm.DTPicker2.Day=d;
f.WriteLine("DTPicker2.Day = "+thisForm.DTPicker2.Day);

thisForm.DTPicker2.Month=m;
f.WriteLine("DTPicker2.Month = "+thisForm.DTPicker2.Month);

thisForm.DTPicker2.Year=y;
f.WriteLine("DTPicker.Year = "+thisForm.DTPicker2.Year);

f.Close();
}

The first line of the file (i.e. the Date() object values) would be written as expected. However when the page failed, no other values would be written. This suggests that the error occurs when assigning the DTPicker1.Day value.
A colleague of mine suggested that the assignment is not given enough time.

Hence I need to try to delay the page while it assigns the values.
Matt
Tubedale Communications Ltd (Bristow-Solutions (Software Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top