SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Aug 2000
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone here know how the size of a frame can be changed without reloading a new frames page? I have tried things like

    document.frames[0].width=10

    but can't get anything to work. Although there is a lot of info on frames out there I can't find anything on resizing them. Is there no way to do this? Any comments would be greatly appreciated, even if it is only to say "I don't think so".

    Thanks.



  2. #2
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,939
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well that little snippet wouldn't work because what page would you put it on?

    The frame page is the parent document not the actual document.

    But I've never heard nor seen of frames resizing themselves automatically... you could create some crazy effects like that though.

    "Oh no the room is getting smaller!"

    Chris

  3. #3
    SitePoint Member
    Join Date
    Aug 2000
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry I forgot to say that the function was in the parent but triggered from a child. No problem though. Someone has just shown me that you can do it through a function with:

    parent.myFrames.cols="120,*"

    I have tried it and it seems to work well in IE (where no reloading occurs) but not at all in NS.

    By linking this to other functions I hope to have the menu bar glide into the page when the mouse is over it, and then glide (almost fully) out when the mouse is in the main page.


    [This message has been edited by Tigree (edited August 08, 2000).]

  4. #4
    SitePoint Member
    Join Date
    Aug 2000
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well it does work. Unfortunately I now have another problem (or two).

    1) Is there a way of stopping one function with another one? My page starts with the navigation buttons only partially visible on the left of the screen. I have a timeout in the function which opens my navigation buttons frame when the mouse is over it (this allows me to glide it open rather than just pop it open). Naturally I have the same sort of thing to close it when the mouse is in the main frame. The problem seems to be that if either timeout functions hasn't finished before the other one is started then one function is trying to close the frame and the other one to open it - and the whole screen goes into a funny kind of dance! Hence I need a command in each function which will stop the other one (The function I am using is an 'if' function).

    2) The method I am using to recognise when the mouse is in one or the other frame, is to put a <DIV> tage just after the opening <BODY> tage and then </DIV> after </BODY>. This method isn't perfect. The mouseover is only recognised if the mouse is over (or horizontaly across from) some text or an object. Does anyone know how to recognise if the mouse is in any part of the frame - not just the part with text or something?

    Thanks again in advance.


    [This message has been edited by Tigree (edited August 09, 2000).]

  5. #5
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote/font><HR>Is there a way of stopping one function with another one?<HR></BLOCKQUOTE>

    Try setting a flag for each function. i.e. while the opening function is doing its work, set opening=true. Then start your closing function with if (opening) return; to cancel the closing operation if an opening operation is in progress.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote/font><HR>Does anyone know how to recognise if the mouse is in any part of the frame - not just the part with text or something?<HR></BLOCKQUOTE>

    Try putting your onMouseOver event handler in the &lt;body&gt; tag. This will only work in MSIE 4+, but since frame resizing is not supported by Netscape anyway this is no loss to you.

    ------------------
    -Kevin Yank.
    http://www.SitePoint.com/
    Helping Small Business Grow Online!

    [This message has been edited by kyank (edited August 08, 2000).]

  6. #6
    SitePoint Member
    Join Date
    Aug 2000
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried setting a flag for each function and it workes perfectly! Thanks! Unfortunately what I wanted to do was get the new function to stop the old one. Not get the new function to wait for the old one to finish. Does that make sense? That is, I don't want the user to have to wait until the buttons have finished closing before they can open again (or vice versa). I have tried everything I can think of to break the old timeout function before the new one starts but can't. If you can solve this one I would be very greatful.

    As far as the onMouseOver event handler in the &lt;body&gt; tag is concerned, it doesn't seem to be recognised. Would it be possible to use the mouse coordinates to set off my functions?

  7. #7
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote/font><HR>Originally posted by Tigree:
    I don't want the user to have to wait until the buttons have finished closing before they can open again (or vice versa).<HR></BLOCKQUOTE>

    How about using a single flag variable (e.g. nowDoing) for both functions? This flag could have two values: "opening" and "closing". Now, your onMouseOver event handler that triggers the 'opening' function should set nowDoing="opening" before calling the opening function. The event handler that triggers the 'closing' function similarly should set nowDoing="closing" before calling its function. Each function is then set to bail out if it detects nowDoing set to the opposite value (i.e. your 'opening' function would have if (nowDoing != "opening") return;.

    Make sense?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote/font><HR>As far as the onMouseOver event handler in the &lt;body&gt; tag is concerned, it doesn't seem to be recognised.<HR></BLOCKQUOTE>

    Odd. The following simple example seems to work as expected here:

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>&lt;HTML&gt;
    &lt;HEAD&gt;
    &lt;TITLE&gt; Title &lt;/TITLE&gt;
    &lt;SCRIPT LANGUAGE="JavaScript"&gt;
    &lt;!--

    function testFunc() {
    alert("Boo!");
    }

    //--&gt;
    &lt;/SCRIPT&gt;
    &lt;/HEAD&gt;
    &lt;BODY onMouseOver="testFunc()"&gt;
    &lt;P&gt;Place your mouse in this window to see a pop-up message box!&lt;/P&gt;
    &lt;/BODY&gt;
    &lt;/HTML&gt;
    [/code]

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote/font><HR>Would it be possible to use the mouse coordinates to set off my functions? <HR></BLOCKQUOTE>

    Not a good idea. This would be unreliable and far too complex script-wise.

    ------------------
    -Kevin Yank.
    http://www.SitePoint.com/
    Helping Small Business Grow Online!

  8. #8
    SitePoint Member
    Join Date
    Aug 2000
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Kevin.

    Thank you very much! The flag variable works perfectly, and as for the onMouseOver in the &lt;body&gt; tag, it also works now! Strange ... I must have been doing something wrong.

    I have actually just managed to trigger events with the position of the mouse, and better still the script is simple and 100% reliable. I have included it below incase anyone is interested. It executes expand() every time the mouse touches the left of the screen. I initially thought that the onmousemove would slow my pages. However this does not seem to be the case.

    &lt;head&gt;
    &lt;script language="JavaScript"&gt;

    document.onmousemove=check;

    function check(e) {
    if (event.x==0)
    setTimeout('expand()', 1)
    }

    &lt;/script&gt;
    &lt;/head&gt;

    Without the setTimeout, expand() would not finish executing until the mouse was taken away from the left side of the screen. Hence the reason for the setTimeout. If anyone can explain why this is the case I would be interested to hear from you.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •