Oscar van Eijk

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromOscar van Eijk
ToMe
SubjectLooking for JavaScript knowledge for a new open-source project
Date25 February 2004 18:13
AttachmentsTwo JS files that manage DHTML windows
Hi Mark,

Browsing the web looking for JavaScript info I came across your site; a
huge amount information, great job!

I am working on a new product (I'm not sure yet if it's gonna be GPL or
another (half)open source product), called xxxxxxxxxxx.
It's developed mainly in PHP, but it uses a lot of JavaScript.

Two important JS files are attached to this mail for your info, but
basically my question is, are you interested in getting involved with
this project?

I'm developing on Linux (RH9), using Mozilla 0.9 and Konqueror 3.1 for
testing so far. I am now ready to put the first alpha release online; it
can be seen at xxx.xxxxxxxxxxx.xxx.
However; it works only with Mozilla at the moment. I started testing
with IE only very recently, and get a lot of errors --- hence the
browsing that brought me to you.

I understand you can use Linux/Mozilla to have a look at the preview
site and get an impression of what it should do. Please have a look, the
preview tells you more than I can do in this mail.
Don't mind the content; it's mainly test data in there, and half of the
texts are in Dutch.

If you wanna have a look at the full source; it can be downloaded from
[an ftp site].

If you are interested in having a look and help me out with the browser
issues, please let me know.

Hope to hear from you soon,
Take care,
Oscar van Eijk
FromMe
ToOscar van Eijk
SubjectRe: Looking for JavaScript knowledge for a new open-source project
Date25 February 2004 09:08
Oscar,

Looks a lot like my mini windows, but using iframes ... hmmm ....

I'm afraid I currently have too many projects to get involved full time,
but I am always willing to help if there is a specific problem that needs
solving. Could you tell me what parts of the scripts don't work, and I will
try to see why? There is so much there so I have no idea what is not
working. However, here are some pointers:

You are using eventObject.which for your resizing etc. IE does not support
which. see:
http://www.howtocreate.co.uk/tutorials/javascript/eventinfo
The reason I think your JS is not working is that you are using
measurements that don't work cross browser. see:
http://www.howtocreate.co.uk/tutorials/javascript/browserwindow

As a result, it also does not work in Opera.

I am running Mozilla on Windows XP with 1.8 GHz processor and 512 MB RAM,
and your page runs FAR too slow. It works OK on linux, but I guess you are
registering too many event handlers.
[ED. It is actually due to the fact that browsers don't like handling so
many iframes on one page - especially if they are supposed to move]

I'm not entirely sure why, but when I tried using anything except Mozilla
on windows (NOT linux), it just showed a whole load of PHP errors:

Warning: main(/_path_/TTinit.pinc) [function.main]: failed to create stream:
No such file or directory in /_full path to script_/TTabout.php on line 17

Fatal error: main() [function.main]: Failed opening required
'/_path_/TTinit.pinc' (include_path='.:/_path to_/php') in
/_full path to script_/TTabout.php on line 17


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk
FromOscar van Eijk
ToMe
SubjectRe: Looking for JavaScript knowledge for a new open-source project
Date26 February 2004 14:46
Hi Mark,

Thanks a lot for your answer. First of all, I did not mean to get involved
full-time in this project; for me it's a side project as well, but I leave
it up to you if your interested.

You pointers are of great use; gives me a good starting point. I'll start
digging there and see what I come up with, I'm sure I'll have more
questions, but I'll try to be more specific.

I'm puzzled about the PHP errors you got, but first I'll concentrate on the
client side.

One more question for now; do you have your JavaScript tutorial available in
a printable format as well? I'm willing to pay for it; I already bought
several books about the subject, but none of them could help me out with the
cross-browser issues so far.

Thanks for now,
Oscar van Eijk
FromMe
ToOscar van Eijk
SubjectRe: Looking for JavaScript knowledge for a new open-source project
Date26 February 2004 15:08
My tutorial is not available as a pre-printed version, but you can view it
all as one page to make it easier to print for yourself:

When viewing any part of the tutorial, click on the blue 'JavaScript' link
on the left (just above the 'Important stuff' link). This loads the entire
JavaScript tutorial as one page. Now select a better style combination for
printing using the 'style' dropdown on the left. I would suggest 'no style'.
Now when you print it (over 100 pages!), it should look about right, and
you only need to hit print once.

Now I have to go, before I get snowed in - and I have to cycle a good few
miles to get home!

Tarquin
FromOscar van Eijk
ToMe
SubjectQ about miniwindows vs. Iframes
Date9 March 2004 18:48
Hi Mark,

'bout 2 weeks ago we exchanged a few mails about [Oscar's site].

With the info you gave me and your tutorials I'm now fixing the
JavaScript (at least, I hope :-), but while digging your site for info I
came across a few issues that are pretty important for the design I've
chosen for [Oscar's site].

You edited your online reply to me, saying that too many iframes can
slow down a browser. In replies you sent to other people I also read
iframes can cause several problems, but the main reason I've chosen for
iframes is the ability to load a layer with a new PHP/HTML/Whatever file
using the 'src' attribute. I know you can rewrite the contents of your
miniwindows as well, but as far as I understand, not from the server ---
at least not without reloading the whole page.

Do you know of any other way to reload layers independently from the
server?

Thanks in advance,
Oscar
FromMe
ToOscar van Eijk
SubjectRe: Q about miniwindows vs. Iframes
Date9 March 2004 20:51
> I know you can rewrite the contents of your miniwindows as well, but as
> far as I understand, not from the server --- at least not without
> reloading the whole page. Do you know of any other way to reload layers
> independently from the server?

Yes, but not how you might think.

My mini windows use JavaScript to rewrite their contents, so the 
contents can be rewritten at any time with whatever data the JavaScript
contains.

JavaScript has a limitation in that it cannot get updated information from
a server (a copuple of browsers can use external XML files, but not enough
to be cross-browser). Well, so it would seem. There is a trick you can use
(I have used it myself before), to load data from the server after the
page has loaded. Put an iframe on the page with its visibility style set
to 'hidden'. 

When you want to update something, reload the iframe contents.
document.frames.iframename.window.location.replace('getMore.php?data'+escape(someData));

Then in getMore.php run a function in the parent document:
parent.updateInfo('Some new data');

The function 'updateInfo' on the parent page can then use the data to
rewrite content.

A bit hackish, but it works, and although there will be an iframe on the
page, at least it will not need to move anywhere, so it should not cause
any slow-down or other problems. I have found this to be a very good way
to produce a seamless effect.

Tarquin
FromOscar van Eijk
ToMe
SubjectSee when an IFRAME finished loading
Date23 April 2004 11:11
Hi Tarquin,

I'm struggling with [Oscar's site] (see the mails between Feb 25 and Mar 9),
to get rid of the IFrames.
I'm following your suggestions; using 2 hidden IFrames as client-server
interfaces.

The problem I came across now is, I need to know when a page from the server
is fully loaded so I can start copying it to the DIV. I know I can use the
BODY's onload(), but I'ld like to have it on the main page, so any page can
be loaded that way.

I can't find a way to get this triggered without changing the contents of
the IFrame source; is this possible in any way (cross browser)?

Thanks again,
Oscar
FromMe
ToOscar van Eijk
SubjectRe: See when an IFRAME finished loading
Date23 April 2004 12:03
Ok, this is possible.

I have now written an article on how to load external data:
http://www.howtocreate.co.uk/loadingExternalData.html

I have also written another script for someone that also used onload to
pass the page content to the main page.
http://www.howtocreate.co.uk/emails/RicCarr.html

However, I think neither of these will suit your purpose so I can propose
something else.

Note that you will need to ensure that _every_ page you load comes from
your own server. This is a limitation of JavaScript. It cannot load data
from other servers.

What you are asking for is fairly difficult, but I have included the script
below. You need to create a new iframe for each page you load (this is
because the only way to tell if the page has loaded without using the
intrinsic onload event requires the iframe to have nothing in it to start
with). You then need to repeatedly check if that page has loaded by
checking for the iframe name in the frames collection. If it has loaded,
you can stop checking and use its contents.

var ifDL = [];
function loadPage(oURL,oFunct) {
 var ifr = document.createElement('DIV');
 ifr.style.visibility = 'hidden';
 ifr.style.position = 'absolute';
 ifr.style.top = '0px'; ifr.style.left = '0px';
 ifr.innerHTML = '<iframe src="'+oURL+'" name="loader_'+ifDL.length+
   '" height="0" width="0"><\/iframe>';
 ifDL[ifDL.length] = oFunct;
 document.body.appendChild(ifr);
}
function checkLoad() {
 for( var x = 0; x < ifDL.length; x++ ) {
   if( ifDL[x] && window.frames['loader_'+x] ) {
     eval( ifDL+ '(window.frames.loader_'+x+'.window.document);' );
     MWJ_ldD[x] = false;
   }
 }
}
window.setInterval('checkLoad();',100); }



you can load a page like this:
function getPageData(oDoc) {
 //do something with the data
 document.getElementById('outputTarget').innerHTML = oDoc.body.innerHTML;
}
loadPage('mypage.html','getPageData')


hope this does what you need.

Tarquin
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.