[Javascript] refresh on resize window/reload .js file only

Russell Scheinberg rscheinberg at lrk.com
Thu May 17 15:11:35 CDT 2001


The script does not create the form information. That is all ASP. 

I tried this and I get "Error:Not implemented" referring to [document.body.onresize=loaderRefresh()]. If I click through the error, then I get the page OK with the menus placed correctly. But then nothing happens when I resize the window. That is the window resizes but the menus maintain their original position.


Tell me please what I might be doing wrong.

Here is the code:

<SCRIPT ID="Loader" LANGUAGE="JavaScript1.2" SRC="HM_Loader.js" TYPE='text/javascript'></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
document.body.onresize = loaderRefresh()

function loaderRefresh(){
   Loader.src = "HM_Loader.js"
}

//-->
</SCRIPT>

If I do it this way I get the error. If I place a onResize="loaderRefresh()" in the body tag instead, the script does not reload when the window is resized. However, onResize="location.reload()" works fine, but it reloads all the data in the forms as well, which I don't want. I have to think that the function is not set up right.

Thanks.

>>> Trojani2000 at hotmail.com 05/16/01 10:22PM >>>




----- Original Message -----
From: Russell Scheinberg
Sent: Tuesday, May 15, 2001 10:16 PM
To: javascript at LaTech.edu 
Subject: [Javascript] refresh on resize window/reload .js file only


I would like to create a function that will cause the window to refresh whenever the window is resized. Anyone know how to do this or can point me to a site that has this explained?  Also, is there a way to reload a javascript source file without reloading the rest of the data that might be loaded on the page from the server or that has been input into form elements? Thanks.

******************************************************
Well, your first question has been answered.
As about the second one, try this:
1. Give you're script an ID.
<script id="refreshing" src="refreshable.js">
</script>
2. Choose you're event for reloading the script src,- for example I will use the onClick :
someElementID.onclick=scriptRefreshfunction
                  *[someElementID] is the ID of the element that you like to fire the event.
           
3. Write the function:
function scriptRefreshfunction(){  refreshing.src="the_address_of_the_script\\refreshable.js"    }
But in case that this script (efreshable.js) writes the actual Forms of the page. You're form-inputs will be lost I guess, but who knows, -sometimes the forms do not loose focus even if they are refreshened, -there are casses that even the input data remains, but that's a bug!
Cheers!
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu 
http://www.LaTech.edu/mailman/listinfo/javascript<br clear=all><hr>Get Your Private, Free E-mail from MSN Hotmail at <a href="http://www.hotmail.com">http://www.hotmail.com</a>.<br></p>





More information about the Javascript mailing list