1 Replies - 383 Views - Last Post: 15 August 2012 - 07:48 PM

#1 Glorfindal  Icon User is offline

  • Java Enthusiast
  • member icon

Reputation: 23
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Issues with Frames

Posted 15 August 2012 - 12:17 PM

I have a text-based browser game I am creating and if you have chat enabled I have 3 frames set up. The top and the biggest one is the main content frame and then on the bottom there are two split horizontally one is the chat and the other across from it displays the "Players Online".

I am trying to create a clean looking chat using AJAX and I want to pass to the page the size of the frame so that it will look good on almost any resolution and I can manipulate the number for each part of the chat's size.

So I found a few functions on the internet and wrote some javascript to do that and then change the frame and provide the height as a parameter in the URL.

However, the frames worked before and now it just displays a blank page here is my HTML and Javascript code.

<html>
<head>
<script type="text/javascript">
    function getFrameHeight(frameID) {
        var result = 0;
        if(document.getElementById) {
            var frame = parent.document.getElementById(frameID);
            if(frame.scrollWidth) {
                result = frame.scrollHeight;
            }
        }
    }
    function doLoad() {
        setTimeout("changeFrame()", 1500);
    }
    function changeFrame() {
        x = document.getElementById("chat");
        x.changeFrame("Chat/index.asp?height=" + getFrameHeight("chat"))
    }
</script>
</head>
<body onload="doLoad()"></body>
<frameset rows="75%,25%"><frame src="dragoth/default.asp?message=%203%20turns%20have%20been%20added%20to%20your%20account" name='content'></frameset>
<frameset cols="75%,25%"><frame src="Chat/chatpreloader.asp" id="chat"><frame src="online.asp"></frameset></html>


Is This A Good Question/Topic? 0
  • +

Replies To: Issues with Frames

#2 Glorfindal  Icon User is offline

  • Java Enthusiast
  • member icon

Reputation: 23
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Re: Issues with Frames

Posted 15 August 2012 - 07:48 PM

Well I think I figured out the solution myself. So I'll post it here for future reference. Basically it doesn't seem to work when I have the script in the HTML page with the framesets so I put the javascript on one of the included pages and used the top.document instead of just document.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1