CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Simple Problem

  1. #1
    Join Date
    Mar 2002
    Posts
    132

    Simple Problem

    Hello Friends.
    Can anybody tell me whats wrong in this code, its giving runtime error whenever i click the mainframe, rather than alert. Both mainFrame.htm and topmenu.htm are empty files


    Code:
    <html>
     <head>
      <title>
        Testing Co-Browsing
      </title>
      <script language="javascript">
      function ButtonClick()
      {
        alert("Hello");
      }
    </script>
    
     </head>
     <frameset rows="15%,85%">
       <frame src="topmenu.htm" name="topmenu">
       <frame src="mainframe.htm" name="mainwindow" onClick="ButtonClick()">
     </frameset>
    </html>

    thanx
    saddysan

  2. #2
    Join Date
    Nov 2002
    Posts
    23
    try

    alert("Hello")

    without ";"

  3. #3
    Join Date
    Apr 2000
    Location
    Germany
    Posts
    122
    I tried out your code and with Netscape 7.0 it worked. It complained that it could not find topmenu.htm and mainframe.htm and filled both areas with white space but the click over mainframe.htm still activated the alert().
    And the ";" at the end was unimportant, with or without netscape likes it.

    However with IE 6.0 it complained about not finding the two pages and filled both areas with standard "not found" pages. And the click over the lower frame did not work.

    Frames were originally introduced by Netscape and IE caught up with them in version 3. But many other browsers don't implement them at all I've heard.

    It's a browser to browser question.

  4. #4
    Join Date
    Dec 2002
    Posts
    10
    you could try putting the alert within mainframe.htm

  5. #5
    Join Date
    Dec 2002
    Location
    Memphis, San Antonio, and Evansville, IN
    Posts
    5

    Lightbulb

    The frameset is simply a double browser display. It's not going to be aware of events in the same way as a regular browser display.

    What vickers_bits suggested is correct. In otherwords, the click event is taking place within "mainframe.htm" not the frameset.

    Simply move your script function to mainframe.htm and motify your body tag in mainframe.htm according the example below, and all should work fine.

    <body onclick="ButtonClick()">

    Hope this helps...

    JT

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured