Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Javascript and when it is executed...

Reply
Thread Tools

Javascript and when it is executed...

 
 
Sonnich Jensen
Guest
Posts: n/a
 
      08-24-2007
Hi!

Not sure whether it is the right solution, but this is what I cam up
with.

A header and an image for waiting...
<img src="bigrotation2.gif" name="load1">

then, when loaded, it should set the height to 0, or something.

But
<body onload="load1.height=0;">
does not work - though executed (tested with an alert as first thing)

And trying this
</table><p>
<script language="JavaScript" type="text/JavaScript"><!--
load1.height=0;
--></script>
when the table has loaded, did not work - the script (again tested
with an alert) is excuted _before_ the table is loaded. Not sure how
that is possible, as the code is not even sent to the user yet. (why?)

I usually work in PHP.

Basically, I want to set the height to 0 once loaded. Any ideas?

BR
Sonnich

 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      08-24-2007
Sonnich Jensen wrote:
> Not sure whether it is the right solution, but this is what I cam up
> with.


For what problem?

> A header and an image for waiting...
> <img src="bigrotation2.gif" name="load1">


The required `alt' attribute is missing. http://validator.w3.org/

> then, when loaded, it should set the height to 0, or something.


Why?

> But
> <body onload="load1.height=0;">
> does not work - though executed (tested with an alert as first thing)


As it should. You are assuming that because the MSHTML DOM makes element
object references available as properties of a host object in the scope
chain, it is so in all UAs. It isn't.

document.images["load1"].height = 0;

may work.

> And trying this
> </table><p>
> <script language="JavaScript" type="text/JavaScript"><!--


Omit the deprecated `language' attribute and the error-prone pseudo-comment
declaration. A `p' element also should not contain a `script' element
because if script support is absent, the paragraph spacing is displayed anyway.

> load1.height=0;
> --></script>


The closing pseudo-comment is a syntax error. Remove it.

> when the table has loaded, did not work -


http://www.jibbering.com/faq/faq_not...ml#ps1DontWork

> the script (again tested with an alert) is excuted _before_ the table
> is loaded.


Unlikely. It may be executed before the table is fully rendered.

> Not sure how that is possible, as the code is not even sent to the
> user yet. (why?)


Have you removed the `onload' attribute from the `body' element before
testing the second approach?

> I usually work in PHP.


That is irrelevant, as you generate (X)HTML.

> Basically, I want to set the height to 0 once loaded. Any ideas?


HTH


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
 
Reply With Quote
 
 
 
 
Sonnich Jensen
Guest
Posts: n/a
 
      08-24-2007
On Aug 24, 4:19 pm, Thomas 'PointedEars' Lahn <(E-Mail Removed)>
wrote:
> Sonnich Jensen wrote:
> > Not sure whether it is the right solution, but this is what I cam up
> > with.

> For what problem?


It takes ~5 secs to load the page. A wait.... thing

> > A header and an image for waiting...
> > <img src="bigrotation2.gif" name="load1">

> The required `alt' attribute is missing. http://validator.w3.org/

Added.

> > then, when loaded, it should set the height to 0, or something.

> Why?


No waiting anymore...
Or, I could "remove" then waiting img.

> > But
> > <body onload="load1.height=0;">
> > does not work - though executed (tested with an alert as first thing)

> As it should. You are assuming that because the MSHTML DOM makes element
> object references available as properties of a host object in the scope
> chain, it is so in all UAs. It isn't.
> document.images["load1"].height = 0;
> may work.


It does.

>
> > And trying this
> > </table><p>
> > <script language="JavaScript" type="text/JavaScript"><!--

>
> Omit the deprecated `language' attribute and the error-prone pseudo-comment
> declaration. A `p' element also should not contain a `script' element
> because if script support is absent, the paragraph spacing is displayed anyway.
>
> > load1.height=0;
> > --></script>

>
> The closing pseudo-comment is a syntax error. Remove it.
>
> > when the table has loaded, did not work -

>
> http://www.jibbering.com/faq/faq_not...ml#ps1DontWork



Then they did not make it the way I want it to :-]

>
> > the script (again tested with an alert) is excuted _before_ the table
> > is loaded.

>
> Unlikely. It may be executed before the table is fully rendered.


Took a closer look. Also at the watch. Found out it is friday evening
and I need a beer.
Also found, that it was at the end of the wrong table
Realised, that I really need that beer.

Thanks
Sonnich

 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      08-24-2007
Sonnich Jensen wrote:
> On Aug 24, 4:19 pm, Thomas 'PointedEars' Lahn <(E-Mail Removed)>
> wrote:
>> Sonnich Jensen wrote:
>>> Not sure whether it is the right solution, but this is what I cam up
>>> with.

>> For what problem?

>
> It takes ~5 secs to load the page. A wait.... thing


I daresay you are trying (and failing) to cure the symptoms here. Why is
your document this large that it takes ~5 seconds to load? Do you think
*adding* a wait image will actually *reduce* download/rendering time?

>>> then, when loaded, it should set the height to 0, or something.

>> Why?

>
> No waiting anymore...
> Or, I could "remove" then waiting img.


Good idea

>>> the script (again tested with an alert) is excuted _before_ the table
>>> is loaded.

>> Unlikely. It may be executed before the table is fully rendered.

>
> Took a closer look. Also at the watch. Found out it is friday evening
> and I need a beer.
> Also found, that it was at the end of the wrong table
> Realised, that I really need that beer.


Cheers


\\// PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$(E-Mail Removed)>
 
Reply With Quote
 
Sonnich Jensen
Guest
Posts: n/a
 
      08-27-2007
On Aug 24, 4:45 pm, Thomas 'PointedEars' Lahn <(E-Mail Removed)>
wrote:
> SonnichJensen wrote:
> > On Aug 24, 4:19 pm, Thomas 'PointedEars' Lahn <(E-Mail Removed)>
> > wrote:
> >>SonnichJensen wrote:
> >>> Not sure whether it is the right solution, but this is what I cam up
> >>> with.
> >> For what problem?

> > It takes ~5 secs to load the page. A wait.... thing

> I daresay you are trying (and failing) to cure the symptoms here. Why is
> your document this large that it takes ~5 seconds to load? Do you think
> *adding* a wait image will actually *reduce* download/rendering time?


Fortunately yes. I am looking for another solution, but so far this is
the fastest we have.
Secondly, it is for in-house only.

> >>> then, when loaded, it should set the height to 0, or something.
> >> Why?

> > No waiting anymore...
> > Or, I could "remove" then waiting img.

> Good idea


**** Just how do I free an image....?

> >>> the script (again tested with an alert) is excuted _before_ the table
> >>> is loaded.
> >> Unlikely. It may be executed before the table is fully rendered.

> > Took a closer look. Also at the watch. Found out it is friday evening
> > and I need a beer.
> > Also found, that it was at the end of the wrong table
> > Realised, that I really need that beer.

> Cheers


Thanks

Sonnich

 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      08-27-2007
Sonnich Jensen wrote:
> [...] Thomas 'PointedEars' Lahn [...] wrote:
>> SonnichJensen wrote:
>>> [...] Thomas 'PointedEars' Lahn [...] wrote:
>>>> SonnichJensen wrote:
>>>>> Not sure whether it is the right solution, but this is what I cam up
>>>>> with.
>>>> For what problem?
>>> It takes ~5 secs to load the page. A wait.... thing

>> I daresay you are trying (and failing) to cure the symptoms here. Why is
>> your document this large that it takes ~5 seconds to load? Do you think
>> *adding* a wait image will actually *reduce* download/rendering time?

>
> Fortunately yes. I am looking for another solution, but so far this is
> the fastest we have.


Adding data will never reduce download time.

> Secondly, it is for in-house only.


Still it is obviously too much.

>>>>> then, when loaded, it should set the height to 0, or something.
>>>> Why?
>>> No waiting anymore...
>>> Or, I could "remove" then waiting img.

>> Good idea

>
> **** Just how do I free an image....?


I meant you should simply remove the wait image from your code, thereby
eliminating that part of the problem.

However, DOM Level 2 Core support provided, you can remove the element from
the document tree afterwards:

<body
onload="var o = document.images["wait"]; o.parentNode.removeChild(o);">
...
<script type="text/javascript">
document.write(
'<img src="wait.jpg" alt="Please stand by" name="wait">');
</script>
...
</body>

I recommend against that, though.


HTH

PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
 
Reply With Quote
 
jodleren
Guest
Posts: n/a
 
      08-27-2007
On Aug 27, 3:59 pm, Thomas 'PointedEars' Lahn <(E-Mail Removed)>
wrote:
> SonnichJensen wrote:
> > [...] Thomas 'PointedEars' Lahn [...] wrote:
> >> SonnichJensen wrote:
> >>> [...] Thomas 'PointedEars' Lahn [...] wrote:
> >>>> SonnichJensen wrote:
> >>>>> Not sure whether it is the right solution, but this is what I cam up
> >>>>> with.
> >>>> For what problem?
> >>> It takes ~5 secs to load the page. A wait.... thing
> >> I daresay you are trying (and failing) to cure the symptoms here. Why is
> >> your document this large that it takes ~5 seconds to load? Do you think
> >> *adding* a wait image will actually *reduce* download/rendering time?

>
> > Fortunately yes. I am looking for another solution, but so far this is
> > the fastest we have.

>
> Adding data will never reduce download time.


I agree. Just to clear things up, it takes 5 seconds to generate the
page. Certain checks (currently reading 91 directories and no I did
not come up with that idea).
The thing I could use, would be a way to ask for files as ABC*.ggg, a
wildcard. With PHP I have to read the entire directory in.

BR
Sonnich

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript and IE? Javascript and C#? porter Javascript 6 10-06-2007 10:03 AM
dynamic javascript and html using javascript parez Javascript 0 09-11-2007 04:08 PM
JavaScript or not JavaScript Mark Rae ASP .Net 36 09-09-2006 01:12 PM
href="javascript:func()" vs href="#" onclick="javascript:func()" CRON HTML 24 06-20-2006 08:05 PM
Javascript -> Applet: variable reset after method call from javascript?! mcdeveloper Java 1 06-13-2006 08:34 AM



Advertisments