| | |
Script works in IE, but not in Firefox
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jul 2008
Posts: 14
Reputation:
Solved Threads: 0
I decided to try and redo a site I'd had active ages ago and while looking over things to see what needed to be fixed, tweaked, and just in general redone I discovered that while viewing the site in IE everything works just as it should, but in Firefox the scrolling script doesn't seem to be working.
I didn't write the original piece of code, and so I'm kind of stumped as to how to fix it to work in Firefox. I do know the problem is somewhere in this chunk of code however. Any help on this would be greatly appreciated.
I didn't write the original piece of code, and so I'm kind of stumped as to how to fix it to work in Firefox. I do know the problem is somewhere in this chunk of code however. Any help on this would be greatly appreciated.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<script language="JavaScript" SRC="dynlayer.js"></SCRIPT> <script language="JavaScript" SRC="miniscroll.js"></SCRIPT> <script language="JavaScript"> <!-- function init() { DynLayerInit() myscroll = new MiniScroll(scrollWindow,scrollContent) } //--> </SCRIPT> <STYLE TYPE="text/css"> <!-- #scrollWindowDiv {position:absolute; left:0; top:5; width:400; height:250; clip:rect(0,400,250,0);} #scrollContentDiv {position:absolute; left:0; top:5; width:400;} #scrollbtnDiv {position:absolute; left:400; top:5; width:30;}--> </STYLE> <script language="JavaScript"> <!-- preloadwh1 = new Image(); preloadwh1.src = "up.gif"; preloadwh2 = new Image(); preloadwh2.src = "down.gif"; preloadlogo = new Image(); preloadlogo.src = "logo.jpg";// --> </script> </HEAD> <body onLoad="init()" text="#000000" vlink="#6699FF" link="#6699FF" alink="#000000" bgcolor="#FFFFFF" topmargin="10" leftmargin="0" marginwidth="0" marginheight="0"> <DIV ID="scrollWindowDiv"> <DIV ID="scrollContentDiv">
•
•
Join Date: Jul 2008
Posts: 14
Reputation:
Solved Threads: 0
ACK! Sorry, I forgot completely about those... There are two .js files that are supposed to work together to create the scrolling effect. The first is the miniscroll.js file which I don't think there is a problem with from what I can tell. Then there is the dynlayer.js file, which looking at I've found a problematic block (and quite possibly the one responsible for the malfunction) that I don't know how to edit or change. I've attached both of the files, but below is what I believe might be the problem.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
// BrowserCheck Object function BrowserCheck() { var b = navigator.appName if (b=="Netscape") this.b = "ns" else if (b=="Microsoft Internet Explorer") this.b = "ie" else this.b = b this.version = navigator.appVersion this.v = parseInt(this.version) this.ns = (this.b=="ns" && this.v>=4) this.ns4 = (this.b=="ns" && this.v==4) this.ns5 = (this.b=="ns" && this.v==5) this.ie = (this.b=="ie" && this.v>=4) this.ie4 = (this.version.indexOf('MSIE 4')>0) this.ie5 = (this.version.indexOf('MSIE 5')>0) this.min = (this.ns||this.ie) } is = new BrowserCheck()
The problem is that in firefox it is not finding the div tags in the body of your file.
The function that has the problem is located in the dynlayer.js file
U can replace that function with this one, i hope it will work for u.
The function that has the problem is located in the dynlayer.js file
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
function DynLayerInit(nestref) { if (!DynLayer.set) DynLayer.set = true if (is.ns) { if (nestref) ref = eval('document.'+nestref+'.document') else {nestref = ''; ref = document;} for (var i=0; i<document.getElementsByTagName("div").length; i++) { var divname = document.getElementsByTagName("div")[i].id var index = divname.indexOf("Div") if (index > 0) { eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")') } } if (DynLayer.refArray.i < DynLayer.refArray.length) { DynLayerInit(DynLayer.refArray[DynLayer.refArray.i++]) } } else if (is.ie) { for (var i=0; i<document.all.tags("DIV").length; i++) { var divname = document.all.tags("DIV")[i].id var index = divname.indexOf("Div") if (index > 0) { eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")') } } } return true }
U can replace that function with this one, i hope it will work for u.
Last edited by Thirusha; Jul 16th, 2008 at 4:41 am.
Please try:
Regards
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<!-- function init() { DynLayerInit() myscroll = new MiniScroll("scrollWindowDiv", "scrollContentDiv") } //-->
Regards
•
•
Join Date: Jul 2008
Posts: 14
Reputation:
Solved Threads: 0
Thirusha, I tried what you suggested however I didn't notice a change - in IE or Firefox.
Sorry if this sounds like a stupid question, but where in the file should this code be placed? As I stated, I did not write the code in the first place (and I am actually, very limited in my knowledge of JS when it comes to writing code).
•
•
•
•
Please try:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<!-- function init() { DynLayerInit() myscroll = new MiniScroll("scrollWindowDiv", "scrollContentDiv") } //-->
Regards
Sorry, I thought you knew.
-Simply replace your existing init function with this one.
(It is located in the head of your document, right after your inclusion of miniscroll and dylayer external script files, and before your style definitions, that is between them two in the header of your main html document).
Cheers.
-Simply replace your existing init function with this one.
(It is located in the head of your document, right after your inclusion of miniscroll and dylayer external script files, and before your style definitions, that is between them two in the header of your main html document).
Cheers.
•
•
Join Date: Jul 2008
Posts: 14
Reputation:
Solved Threads: 0
Oiy... I don't know how I didn't understand where you meant that to go...
Okay, I changed that on one of the pages but it didn't appear to have made any difference to the behavior. What's more, is that after making that change, it no longer works in IE.
Just to make sure that I'm not just a great big schmuck... this is after all - almost ten year old code I'm trying to get to work... I've included the URL for the site I'm trying to make work.
http://is.rt-games.com/index2.html
I left the code you had me change on the first page (message.html)
All other pages reached by the menu have the code as it was before.
Okay, I changed that on one of the pages but it didn't appear to have made any difference to the behavior. What's more, is that after making that change, it no longer works in IE.
Just to make sure that I'm not just a great big schmuck... this is after all - almost ten year old code I'm trying to get to work... I've included the URL for the site I'm trying to make work.
http://is.rt-games.com/index2.html
I left the code you had me change on the first page (message.html)
All other pages reached by the menu have the code as it was before.
In the miniscroll.js replace the following lines
with this
I tried to test it on my side with some of your code from the site, and no error is shown.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
this.contentHeight = (is.ns)? this.content.doc.height : this.content.elm.scrollHeight this.contentWidth = (is.ns)? this.content.doc.width : this.content.elm.scrollWidth
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
this.contentHeight = (is.ns)? this.content.scrollHeight : this.content.scrollHeight this.contentWidth = (is.ns)? this.content.scrollWidth : this.content.scrollWidth
I tried to test it on my side with some of your code from the site, and no error is shown.
•
•
Join Date: Jul 2008
Posts: 14
Reputation:
Solved Threads: 0
Thirusha, I replaced the code as you advised but like before no change in performance is seen. It doesn't give an error, but then again it never did in the first place. The scrolling just doesn't work... this is unchanged.
It should be noted that the change Troy suggested was only done to one HTML page and impacted that page only. Your change has now broken the scrolling effect in IE as well as it not working in Firefox still. I've left it in place on the site so you can see it as well.
To look at just pages without the frames...
http://is.rt-games.com/message.html <-- This is the page that has Troy's change on it.
http://is.rt-games.com/main.html <-- This is a page that has had no changes made to it and is only effected by changes to the .js files.
It should be noted that the change Troy suggested was only done to one HTML page and impacted that page only. Your change has now broken the scrolling effect in IE as well as it not working in Firefox still. I've left it in place on the site so you can see it as well.
To look at just pages without the frames...
http://is.rt-games.com/message.html <-- This is the page that has Troy's change on it.
http://is.rt-games.com/main.html <-- This is a page that has had no changes made to it and is only effected by changes to the .js files.
Last edited by chellethecat; Jul 24th, 2008 at 5:15 pm. Reason: Clarification
![]() |
Similar Threads
- Javascript Firefox Help (JavaScript / DHTML / AJAX)
- Works in Firefox, not in IE7 (PHP)
- Javascript fails in Firefox (JavaScript / DHTML / AJAX)
- Dynamic iFrame height, not working in ie without refresh. (JavaScript / DHTML / AJAX)
- Opera Javascript bug? (works in Firefox) (JavaScript / DHTML / AJAX)
- Help re scrolling bar not working in firefox, CSS problem (HTML and CSS)
- Javascript and Firefox ISSUES (JavaScript / DHTML / AJAX)
- Need JavaScript/Firefox HELP (JSP)
- Javascript problem in FIREFOX (JavaScript / DHTML / AJAX)
- script works in Opera but not Firefox (Python)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Accordion script
- Next Thread: Troubleshoot script
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child class close column createrange() css cursor decimal dependent design disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms google gwt gxt hiddenvalue highlightedword html htmlform ie8 iframe images index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl listbox math media microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php player post problem progressbar regex runtime scroll search security select shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n





