nielkotze
asked on
Preventing user from using webpage until it is fully loaded
Hi there Experts,
I would like to know what is the best way to prevent the user from using the webpage until it fully loaded.
On one of my pages, I have an iframe that loads just before the </body> tag.
On the same page I have a Javascript Calender that is activated by click on a image on the page, which calls the iframe.
(The Javascript calender is displayed in an iframe)
I have found that sometimes people click on the image to call the calender, BEFORE the <iframe>....... </iframe> code has been executed.
Is there a way to force the user to wait until the page is fully loaded?
Here is some source code:
// the javascript calender display in the iframe and insert the date value into the text box for Arrival Date//
<input type="text" id="RoomOneArrivalDate" name="RoomOneArrivalDate" size="12" onfocus="this.blur()" readonly>
<a onclick="gfPop.fStartPop(d ocument.gb i.RoomOneA rrivalDate ,document. gbi.RoomOn eDeparture Date);retu rn false;"
onMouseOver="javascript:ch eck_status ()" HIDEFOCUS href="javascript:void(0)">
<img name="popcal" align="absbottom" src="calbtn.gif" width="34" height="22" border="0" alt="">
</a>
.
.
.
.
.
// the javascript calender display in the iframe and insert the date value into the text box for Departure Date//
<input type="text" name="RoomOneDepartureDate " id="RoomOneDepartureDate" size="12" onfocus="this.blur()" readonly>
<a onclick="gfPop.fEndPop(doc ument.gbi. RoomOneArr ivalDate,d ocument.gb i.RoomOneD epartureDa te);return false;"
onMouseOver="javascript:ch eck_status ()" HIDEFOCUS href="javascript:void(0)">
<img name="popcal" align="absbottom" src="calbtn.gif" width="34" height="22" border="0" alt="">
</a>
.
.
.
.
<iframe width=174 height=189 name="gToday:normal:agenda .js" id="gToday:normal:agenda.j s" src="ipopeng.htm" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; left:-500px; top:0px;">
</iframe>
</body>
I would like to know what is the best way to prevent the user from using the webpage until it fully loaded.
On one of my pages, I have an iframe that loads just before the </body> tag.
On the same page I have a Javascript Calender that is activated by click on a image on the page, which calls the iframe.
(The Javascript calender is displayed in an iframe)
I have found that sometimes people click on the image to call the calender, BEFORE the <iframe>....... </iframe> code has been executed.
Is there a way to force the user to wait until the page is fully loaded?
Here is some source code:
// the javascript calender display in the iframe and insert the date value into the text box for Arrival Date//
<input type="text" id="RoomOneArrivalDate" name="RoomOneArrivalDate" size="12" onfocus="this.blur()" readonly>
<a onclick="gfPop.fStartPop(d
onMouseOver="javascript:ch
<img name="popcal" align="absbottom" src="calbtn.gif" width="34" height="22" border="0" alt="">
</a>
.
.
.
.
.
// the javascript calender display in the iframe and insert the date value into the text box for Departure Date//
<input type="text" name="RoomOneDepartureDate
<a onclick="gfPop.fEndPop(doc
onMouseOver="javascript:ch
<img name="popcal" align="absbottom" src="calbtn.gif" width="34" height="22" border="0" alt="">
</a>
.
.
.
.
<iframe width=174 height=189 name="gToday:normal:agenda
</iframe>
</body>
use the <body onLoad="" .... > function to know when your page is finished loading.
or
<script>
loaded=false;
<input type="text" id="RoomOneArrivalDate" name="RoomOneArrivalDate" size="12" onfocus="this.blur()" readonly>
<a onclick="if (loaded) gfPop.fStartPop(document.g bi.RoomOne ArrivalDat e,document .gbi.RoomO neDepartur eDate);ret urn false;"
onMouseOver="javascript:ch eck_status ()" HIDEFOCUS href="javascript:void(0)"> <img
name="popcal" align="absbottom" src="calbtn.gif" width="34" height="22" border="0" alt=""></a>
and in iframe do
parent.loaded=true
.
.
<script>
loaded=false;
<input type="text" id="RoomOneArrivalDate" name="RoomOneArrivalDate" size="12" onfocus="this.blur()" readonly>
<a onclick="if (loaded) gfPop.fStartPop(document.g
onMouseOver="javascript:ch
name="popcal" align="absbottom" src="calbtn.gif" width="34" height="22" border="0" alt=""></a>
and in iframe do
parent.loaded=true
.
.
ASKER
I know that I have to use a javascript in conjunction with the onLoad event....
What I don't know, is the javascript code how to actually do it
What I don't know, is the javascript code how to actually do it
ASKER
Oops ignore my previous posting..... i posted it before I saw the comment of mplungjan !
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ok, :-)
I cannot type today anyway. loadec should be loaded
I cannot type today anyway. loadec should be loaded
ASKER
Hi there mplungjan,
<script>
loadec=false <<<<== spelling error ? did you mean loaded=false ?
</script>
:-) just checking
Niel Kotze
<script>
loadec=false <<<<== spelling error ? did you mean loaded=false ?
</script>
:-) just checking
Niel Kotze
ASKER
Thanx mplungjan,
Your comment works ! but of course you knew that since you are the expert. Hehe
just by the way..... why the brackets around the loaded ?
just one of those javascript mysteries ?
<a onclick="if (loaded) gfPop.fStartPop.....
Your comment works ! but of course you knew that since you are the expert. Hehe
just by the way..... why the brackets around the loaded ?
just one of those javascript mysteries ?
<a onclick="if (loaded) gfPop.fStartPop.....
No mystery
the if statement syntax is ALWAYS
if (something in brackets that evaluates to true or false) do something
and I could write
if (loaded==true)
but if (loaded) is the same
Opposite test is
if (loaded==false)
and THAT can be written
if (!loaded)
- e.g. if NOT loaded
Michel
the if statement syntax is ALWAYS
if (something in brackets that evaluates to true or false) do something
and I could write
if (loaded==true)
but if (loaded) is the same
Opposite test is
if (loaded==false)
and THAT can be written
if (!loaded)
- e.g. if NOT loaded
Michel