Click to See Complete Forum and Search --> : Javascript function stops the page! Page does not get DONE.


motamedi
11-08-2003, 09:45 AM
Dear friends,

I've run into a problem after uploading my site to my host.
In my site, i use a piece of javascript code to create a new window to show something in.
If this function is called while the main page is not yet DONE, the function causes the main page to stop downloading the remained stuff such as large-size images and so on.
How can I both have my main page continue downloading while the function is called at the same time?

Please check my site: http://www.mahnoushgallery.com/gallery.asp
and click on a thumbnail while the others are still being downloaded. you see that a new window pops and prevents the remained stuff from downloading.

Thanks in advance,
Arash Motamedi

olerag
11-08-2003, 10:10 AM
If you can run Netscape(V)7x, you can pull-up the
Javascript console and have this running in a separate
window. This is a nice troubleshooting aid as it provides
Javascript errors as they occur. From this, you should be
able to find the problem associated with the error.

Maybe someone else has a better idea for javascript
troubleshooting but this is the best one I've found.

olerag
11-08-2003, 10:17 AM
Actually, I visited your site (nice site) after first reply and
things seem to work fine. If a selection is made before
your first page is done, I simply reload the first page and
it finishes loading.

One thing - don't you want your JS code in the <head>
area and not within a <td>???

motamedi
11-08-2003, 10:54 AM
Thanks dear Olerag for your compliment.

1- I don't want to have my visitor press the REFRESH to have the page downloaded completely. It would be rather prefered if the main page ( the gallery page ) keeps on downloading the page objects while the new window is doing it's own. I don't know how come it is when I click on a thumbnail, the status bar of the gallery page shows " DONE " while the images are not fully downloaded yet! ( That presents a really funny page! )

2- There is a fact that the template of site is saved in two static files that are included in each ASP file on the site. Therefore, I do not have direct access to <head> tags. Does that really differ where i put the scripts?! ( SORRY IF THIS IS SUCH FOOLISH QUESTION! I'M JUST A BEGINNER! :D )

-----

Originally posted by olerag
Actually, I visited your site (nice site) after first reply and
things seem to work fine. If a selection is made before
your first page is done, I simply reload the first page and
it finishes loading.

One thing - don't you want your JS code in the <head>
area and not within a <td>??? :D

olerag
11-08-2003, 04:09 PM
I'm not real big on imagery with html pages as I typically
work the db end of it. However, I have seen alot of past
threads in this forum relating to auto-loading of images.

Perhaps something in one of these may help so that
before your page actually views, all of the images are
pre-loaded.

I do like your site but (using my silly dial-up at home) a 56K
modem does take a while to display your page. If a pre-load
takes several minutes before anything shows on your page,
you could have some/lots of visitors leave prematurely.
And I'm sure you don't want that.

Finally, just from general principles, almost all JS scripts
I've ever seen are placed in the <head> tags. Not below
the body. As far as the difference, maybe someone else
could offer more on this subject.

motamedi
11-09-2003, 07:01 AM
Friend,

I've got two suggestions as I've not yet been able to solve the problem the way i like. As far as i've found out, any function, when called, stops the page...

1- We can disable this function until the page is fully loaded. Means we define a variable containing 0 ( for example ) and turn it to 1 on the event of window.onload ( or dowcument.onload??!!! ... I don't recall! )

2- If there are any javascript methods that can refresh a page, we can refresh the main ( gallery ) page when the painting's page is fully loaded. That not only solves the problem, also causes the PAINTING'S PAGE to download faster as the GALLERY PAGE is stopped at that time...

Have you thought of any better idea?

olerag
11-09-2003, 05:45 PM
If what your looking for is to have your Javascript function
fire at the time the page is done loading, consider the
"onLoad()" event placed as part of your <bod> tag. This
should take care of your problem if it is simply that you
want your function run but not until the page is finished
loading.