SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Evangelist jazztie's Avatar
    Join Date
    Mar 2001
    Location
    the Netherlands
    Posts
    519
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Starting functions in another frame

    I have a frame called 'HEADER'. From this frame I would like to innitiate a Javascript Function in a frame called 'CONTENT'. ( function SearchWindow() {....} )

    Is this possible and what should the script look like?

    parent.content... is as far as I got. But I can't find the right function/variable for calling a function.

    Please, any help is appreciated

    Jazz

    The root of the problem is a searchwindow is opened from Header. And in the searchwindow people can click on links... afterwhich the content-frame should change (with an PageID). But I can only get the HEADER frame to respond.

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Simple example:
    Code:
    *** frameset.htm:
    <frameset rows="200,*">
      <frame name="HEADER" src="header.htm">
      <frame name="CONTENT" src="content.htm">
    </frameset>
    
    *** header.htm:
    <html>
      <body>
        <p>Header</p>
        <a href="javascript://" onclick="window.open('pop.htm','','width=200,height=200')">Open popup</a>
      </body>
    </html> 
    
    *** content.htm:
    <html>
      <head>
        <script language="javascript">
          function doSomething()
          {
            alert('Hi!');
          }
        </script>
      </head>
      <body>
        <p>Content</p>
      </body>
    </html> 
    
    *** pop.htm:
    <html>
      <body>
        <p>Popup</p>
        <a href="javascript://" onclick="window.opener.top.frames[1].doSomething()">Call function in CONTENT</a>
      </body>
    </html>


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
  •