Solved

onresize with frames

Posted on 2004-04-10
5
1,269 Views
Last Modified: 2008-03-17
I have a document with 3 frames, and I need to run a function when the user resizes the window.  

Here is how I am handling the event:

<SCRIPT FOR="window" EVENT="onresize" LANGUAGE="JavaScript">
      doFunc();
</SCRIPT>

The problem is, when the window is resized, the function runs 3 times, once for each frame.  How can I get it to only run once?
0
Comment
Question by:scottarius
  • 2
  • 2
5 Comments
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10796444
Where did you keep this code?
In a frame or in html file containing frameset?
0
 

Author Comment

by:scottarius
ID: 10796517
it's in the head of the html file with the frameset.
0
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10796543
Why dont you move this code to one of the html file inside a frame...
0
 
LVL 25

Accepted Solution

by:
devic earned 250 total points
ID: 10796545
try this:
-----------------------
<script>
var resizeCaptured=false;
</script>
<SCRIPT FOR="window" EVENT="onresize" LANGUAGE="JavaScript">
if(!resizeCaptured)
{
    resizeCaptured=true;
      doFunc();
      setTimeout("resizeCaptured=false",1000)
}
</SCRIPT>
0
 

Author Comment

by:scottarius
ID: 10796562
perfect! thanks devic.

i was thinking i might have to set a timeout but wasn't sure the best way to go about it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now