Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scroll Iframe onMouseOver 1

Status
Not open for further replies.

venur

MIS
Aug 26, 2003
418
US
Hi,

Here is what I am trying for and hope some one might help me out. I have MainWindow which have 2 Iframes(frame_form and frame_preview). frame_form have all the form fields and frame_preview have a static html with div id's same as form field names as a place holder. onMouseOver of the frame_form input field I change the color of the corresponding div tag in frame_preview.

But when I scroll the page frame_preview down and on onMouseOver of the text field the preview page is not scorlling up. Below is the code what I am trying.

MainWindow
Code:
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<script language="JavaScript">
 function _over(val)
 {
    var frame_form_doc = window.frames['frame_form'].document;
 	var frame_preview_doc = window.frames['frame_preview'].document;
	frame_preview_doc.getElementById('T1').className='even';
 }

 function _out(val)
 {
    var frame_form_doc = window.frames['frame_form'].document;
 	var frame_preview_doc = window.frames['frame_preview'].document;
	frame_preview_doc.getElementById('T1').className='odd';
 }
</script>

<body>

<p>&nbsp;</p>

<p><iframe name="frame_form" src="frame1.htm" width="874" height="313">
Your browser does not support inline frames or is currently configured not to display inline frames.</iframe></p>
<p><iframe name="frame_preview" src="frame2.htm" width="879" height="150">
Your browser does not support inline frames or is currently configured not to display inline frames.</iframe></p>

</body>

</html>

frame_from
Code:
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>

<body>

<form method="POST" action="--WEBBOT-SELF--">
  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="36%" id="AutoNumber1">
    <tr>
      <td width="50%">&nbsp;</td>
      <td width="50%"><input type="text" name="T1" size="20" onMouseOver="parent._over('T1')" onMouseOut="parent._out('T1')"></td>
    </tr>
    <tr>
      <td width="50%">&nbsp;</td>
      <td width="50%"><input type="text" name="T2" size="20"></td>
    </tr>
    <tr>
      <td width="50%">&nbsp;</td>
      <td width="50%"><input type="text" name="T3" size="20"></td>
    </tr>
    <tr>
      <td width="50%">&nbsp;</td>
      <td width="50%"><input type="text" name="T4" size="20"></td>
    </tr>
  </table>
  <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

</body>

</html>

frame_preview
Code:
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 3</title>
</head>
<style>
 .odd{background-color: white;}
 .even{background-color: gray;}
</style>
<body>

<p><div id="T1">This is a test Page</div></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

</body>

</html>


I hope I am clear with the question. If not let me know.

Thanks
 
Try this:

frame_preview_doc.getElementById(val).scrollIntoView();

Adam

Whatever I feel like I wanna do, gosh!
 
Wow adam. works like a charm. Thanks you and * for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top