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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic scrolldown with FireFox

Status
Not open for further replies.

Rodie

Programmer
Jun 27, 2004
132
FR
Hi all [2thumbsup]

I have an HTML page that contains an <iframe>, called "oWhizzy". This iframe contains a <div> that contains a <table>. The point is that I fill the table rows after rows, and there is a vertical scrollbar that scrolls down automatically.

With Internet Explorer, the automatic scrolldown works, but not on FireFox [sadeyes] Why ?


What I attempt to do is write a javascript function in the <iframe>, to scrolldown the <div> when I load the iframe. But I cannot write javascript in the iframe like follow. I don't know why ...

In the main HTML page, I write the HTML code of the iframe like that:

Code:
var startHTML = "<html>\n";
startHTML += "<head>\n";
startHTML += "<script language=\"javascript\">"   ---> does not work  !!
  ...
startHTML += "</html>\n";

oWhizzy.document.open();
oWhizzy.document.write(startHTML);
oWhizzy.document.close();

Thanks if you have any idea, and if it is not too confusing ... [tongue]
 
Hi Chris [rednose]

Actually, the line that is a problem is this one:
Code:
startHTML += "<script type=\"text/javascript\">";
startHTML += "</script>";    --> this ONE does not work..

The error displayed by IE is: "Unterminated string constant". I don't see what's going on. You have an idea ?

Anyway, thanks a lot !
Rodie
 
Finally I find out how to fix the previous problem.
Code:
startHTML += "\</script\>";   --> works fine

But now, in the javascript part, the following line works fine with Internet Explorer, but not with FireFox !!
Code:
divo = window.frames["myIFrame"].document.getElementById("myDiv");
myIFrame: is an <iframe>
myDiv: is a <div> contained in myIFrame

Anyone has an idea ??
Thanks a lot
 
AFAIK Firefox does not have an array collection of frames. Try accessing it directly:
Code:
window.myIFrame.document.getElementById("myDiv");
 
Or, presumably
Code:
window.getElementById("myIFrame").document.getElementById("myDiv");
It's often easier when developing to build up step-by-step, testing and fixing at each stage, than to try and do the whole thing at once and then figure out where the errors are.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Oh thanks guys !

Actually, my <iframe> was not properly declared:
Code:
<iframe name='myiframe' id='myiframe'>    --> works
<iframe id='myiframe'>           --> DOES NOT WORK

You see how stupid it is !! [mad]
So now I added the "name" and it works.

Thanks a lot to you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top