PDA

Click to See Complete Forum and Search --> : JAVASCRPIT - position a page in the middle of the frame


StevenH
Aug 11th, 2001, 06:34 PM
Here is what I have:

The window.htm contains this code:

<HTML>
<HEAD>
</head>
<frameset rows="100%,0">
<frame name="Top" src="Frame1.htm">
<frame name="Bottom" src="about:blank">

<noframes>
<body>

<p>This page uses frames, but your browser doesn't support them.</p>


</noframes>
</frameset>

This window as you can see contains two frames. Frame1.htm contains:

<SCRIPT language=JavaScript>
function showFrame() {
window.parent.document.all.tags("Frameset")(0).rows = "30%,70%";
}
function hideFrame() {
top.document.all.tags("Frameset")(0).rows = "100%,0";
}
function ProjectFrame() {
top.frames(1).location.href = "http://Test/Proj1/Project1.htm"
}


Those are my two javascript functions. Here is the code where I call the function ShowFrame and ProjectFrame:


<script ID="clientEventHandlersJS" LANGUAGE="javascript">

function ctrlInp_Click(txtParam)
{

var X = txtParam;
ResetValues();

if (X == "Hello")
{
showFrame();
ProjectFrame();
}

If the value in my activex control is = Hello then Showthe bottom frame and display the page in it with Project1.htm

At this Point I want Frame1.htm to display its document at the middle of the frame

Hopefully this will give you better a look at what I am trying to do...

scoutt
Aug 12th, 2001, 08:17 AM
so the <a name=hello> still applies.

top.frames(1).location.href = "http://Test/Proj1/Project1.htm#hello

then in your project1.htm file. you would put <a name=hello> where ever you want it to be. if you put this in the begining of the page it would start there, but if you put it in the middle it would start in the middle. do you understand now??

StevenH
Aug 12th, 2001, 07:06 PM
Thank you for your pateince and assistance!

scoutt
Aug 12th, 2001, 07:44 PM
no prob, let me know if that works