473,404 Members | 2,137 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,404 software developers and data experts.

getURL and Frames

If I use a getURL to retrieve a file and put the contents in a frame
how can I check if the contents loaded in the frame? I don't want to
see a file not found or any errors.

I have a file that has a date (mmddyy) in the file name. So I want to
take todays date check for the file if it's not there check the next
date and so on until I get the file because the file will be there.

Or is there a way to check if a file is on the web server before
loading it?

Thanks.

Jul 23 '05 #1
5 1228
Here is my sample code. I want to check if there's content in the
frame.

<HTML>
<HEAD>

<SCRIPT LANGUAGE="JavaScript">

function load(url,id,width) {

if (window.frames.length > -1)
window.frames[id].location.href = url;
}

</SCRIPT>

</HEAD>

<BODY
ONLOAD="javascript:load('http://www.diamondcomics.com/shipping/shipping_062905.txt','myLayer',400)">

<IFRAME ID="myLayer" WIDTH="400" HEIGHT="400"></IFRAME>

<script language="JavaScript">

var date = new Date();
var d = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
var a = year.toString();
var myYear = a.substring(2);

var text = window.frames[myLayer].document.value;
document.write(text);

</script>

</BODY>
</HTML>

Jul 23 '05 #2

Sounds to me this is for the server language, whichever you are using.
In PHP is very simple doing a FOREACH over a dir() and using file_exists().

Danny

On Sun, 03 Jul 2005 07:58:51 -0700, <cy****@batomic.com> wrote:
If I use a getURL to retrieve a file and put the contents in a frame
how can I check if the contents loaded in the frame? I don't want to
see a file not found or any errors.

I have a file that has a date (mmddyy) in the file name. So I want to
take todays date check for the file if it's not there check the next
date and so on until I get the file because the file will be there.

Or is there a way to check if a file is on the web server before
loading it?

Thanks.


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jul 23 '05 #3
JRS: In article <11********************@f14g2000cwb.googlegroups.c om>,
dated Sun, 3 Jul 2005 10:19:39, seen in news:comp.lang.javascript,
cy****@batomic.com posted :

var year = (yy < 1000) ? yy + 1900 : yy;


There is or has been at least one browser for which that fails.

You can, for a while, use var year = 2000 + yy%100.

Has anyone checked getYear() on various browsers for years in the
range 2095-2105?

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #4
Dr John Stockton wrote:
JRS: In article <11********************@f14g2000cwb.googlegroups.c om>,
dated Sun, 3 Jul 2005 10:19:39, seen in news:comp.lang.javascript,
cy****@batomic.com posted :
var year = (yy < 1000) ? yy + 1900 : yy;

There is or has been at least one browser for which that fails.

You can, for a while, use var year = 2000 + yy%100.

Has anyone checked getYear() on various browsers for years in the
range 2095-2105?


Not that its relevant, in 100 years or so I doubt people will even know
what getYear was for, or that it will still be broken in that time.

var myDates = new Array();

myDates[0] = new Date(2094, 9, 30, 1, 59).getYear();
myDates[1] = new Date(2095, 9, 30, 1, 59).getYear();
myDates[2] = new Date(2096, 9, 30, 1, 59).getYear();
myDates[3] = new Date(2097, 9, 30, 1, 59).getYear();
myDates[4] = new Date(2098, 9, 30, 1, 59).getYear();
myDates[5] = new Date(2099, 9, 30, 1, 59).getYear();
myDates[6] = new Date(2100, 9, 30, 1, 59).getYear();
myDates[7] = new Date(2101, 9, 30, 1, 59).getYear();
myDates[8] = new Date(2102, 9, 30, 1, 59).getYear();
myDates[9] = new Date(2103, 9, 30, 1, 59).getYear();
myDates[10] = new Date(2104, 9, 30, 1, 59).getYear();
myDates[11] = new Date(2105, 9, 30, 1, 59).getYear();
for (i=0;i<myDates.length;i++){
document.write(myDates[i]+', ')
}
IE6:
2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105

Opera 7, Opera 8, Mozilla Firefox 1.0.4 :
194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #5
JRS: In article <gb********************@comcast.com>, dated Mon, 4 Jul
2005 14:01:47, seen in news:comp.lang.javascript, Randy Webb
<Hi************@aol.com> posted :
Dr John Stockton wrote:
Has anyone checked getYear() on various browsers for years in the
range 2095-2105?


Not that its relevant, in 100 years or so I doubt people will even know
what getYear was for, or that it will still be broken in that time.


For those neddies who only wish to show the current date on their pages,
that is so. But javascript is a general-purpose tool, and might be used
to calculate about any date within its range; we cannot predict why.

For a simple example, the upper limit of the DOS internal date format is
in the year of new Date(1980,0,65535) and those using getYear might
like to know whether it increments steadily from now to then.
... (tests, results) ... Those results show that for all tested browsers getYear()

increments at the 2099 to 2100 transition; but none of those currently
return 5, and I have heard of at least one that would.

Thanks.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Jul 23 '05 #6

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

Similar topics

1
by: michal2 | last post by:
Is there any way to have the referring field blank when using the GetURL command?
2
by: therefor | last post by:
I have the following in Flash 8 BriefLook_mc.btnStudentLife_mc.onRelease = function():Void { this.createEmptyMovieClip("craveLoader_mc", this.getNextHighestDepth()); ...
1
neliy
by: neliy | last post by:
hello there. Well I actually have 2 small problems with getURL. I need to connect a button with a web site an my code looks like this: on (release) { getURL("http://www.blahblahblah", "_blank");...
10
by: uninvolved | last post by:
First off hi all, This is probably simple to someone but I'm stuck. I created a button on a flash movie, .swf, insert it into a webpage created in Dreamweaver, the idea is when the button is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.