Click to See Complete Forum and Search --> : Refresh auto when window changes


ikearndt
01-18-2003, 09:08 PM
Is there a way to recognize when a user changes the size of the window and the automatically refresh the window?

Charles
01-18-2003, 09:33 PM
<script type="text/javascript">
<!--
if (navigator.appName == 'Netscape') {window.onresize = function () { window.location.reload()}}
// -->
</script>

ikearndt
01-19-2003, 06:35 AM
I copied the code in the body area and tried it and it did not work and then in th header area and it did not work. www.wvcn.org is the code I would like it to work. If your screen is 1024 and you click favorites to be on the left side. The window changes and the buttons are misaligned. If a refresh is done, the buttons will correct themselves.

Thank You for your help in advance. This is an awesome forum.

Charles
01-19-2003, 06:47 AM
Forgive me; That was just an example showing how to do it with one particular browser. If you want it to always reload on a resize then use, in the document's head:

<script type="text/javascript">
<!--
window.onresize = function () {window.location.reload()}
// -->
</script>

ikearndt
01-19-2003, 01:16 PM
I tried what you said and it is not working. I do not see a reload or refresh working.

I liked your original code, because I will need it to work for Netscape and IE browsers.

If you click this link: www.wvcn.org you can see what I mean. The buttons to the left of the picture and the right need to be resized and this will happen if the window is reloaded when someone changes the window size.

I added both code in the head area and when I resized the window, nothing happened.

Charles
01-19-2003, 01:44 PM
1 - On my browser, there are no buttons on the left or the right - even when I turn the accursed JavaScript on. I'm using Opera 6.05.

2 - The reason my little script isn't working is that you have another onresize handler in the BODY tag. Said handler tries to reload the page when it is resized. You have so much going on and so much bad JavaScript in there that this script's malfunctioning could be caused by anything.

Forgive me for writing this, but you appear to be way over your head here. You should not attempt this kind of JavaScript work unless you know what you are doing.

ikearndt
01-19-2003, 02:40 PM
Yes... There was another onresize in the code. I removed it and the code still did not work.

Your right. I may be a little over my head. But, I still keep trying. Thank You for your help.

I don't know what Oper is.... The buttons are there for IE and Netscape.

Charles
01-19-2003, 02:58 PM
Yes, whatever was causing the original onresize handler to malfunction is causing the replacement handler to malfunction. And even if you do get this figured out it will still fail one in ten times as that many users do not use JavaScript. This wouldn't be such a big deal except that that number includes persons with disabilities that cannot use browsers with JavaScript. It is very important for Church web sites to follow the Web Content Accessibility Guidelines (http://www.w3.org/TR/WCAG10/). 6.3 Ensure that pages are usable when scripts, applets, or other programmatic objects are turned off or not supported. If this is not possible, provide equivalent information on an alternative accessible page. [Priority 1]
For example, ensure that links that trigger scripts work when scripts are turned off or not supported (e.g., do not use "javascript:" as the link target). If it is not possible to make the page usable without scripts, provide a text equivalent with the NOSCRIPT element, or use a server-side script instead of a client-side script, or provide an alternative accessible page as per checkpoint 11.4. Refer also to guideline 1.You need to get rid of all that JavaScript and start with a page that actually works. You will need the HTML 4.01 Specification (http://www.w3.org/TR/html4/) and the validator (http://validator.w3.org/) and you will need to read, mark, learn and inwardly digest those Content Guidelines.