•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 401,485 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,239 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 2373 | Replies: 18 | Solved
![]() |
•
•
Join Date: Jul 2008
Posts: 9
Reputation:
Rep Power: 0
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.
<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: 9
Reputation:
Rep Power: 0
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.
// 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()•
•
Join Date: Mar 2008
Posts: 108
Reputation:
Rep Power: 1
Solved Threads: 12
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
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 3:41 am.
Please try:
Regards
<!--
function init() {
DynLayerInit()
myscroll = new MiniScroll("scrollWindowDiv", "scrollContentDiv")
}
//-->Regards
•
•
Join Date: Jul 2008
Posts: 9
Reputation:
Rep Power: 0
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:
<!-- function init() { DynLayerInit() myscroll = new MiniScroll("scrollWindowDiv", "scrollContentDiv") } //-->
Regards
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).
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: 9
Reputation:
Rep Power: 0
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.
•
•
Join Date: Mar 2008
Posts: 108
Reputation:
Rep Power: 1
Solved Threads: 12
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.
this.contentHeight = (is.ns)? this.content.doc.height : this.content.elm.scrollHeight this.contentWidth = (is.ns)? this.content.doc.width : this.content.elm.scrollWidth
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: 9
Reputation:
Rep Power: 0
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 4:15 pm. Reason: Clarification
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
beta bon browser browsers browsing development echo email encryption eu europe firefox gecko html internet internet explorer internet explorer 7 javascript leak linux memory microsoft mozilla networking news open source open-source opera patch phishing scams security social software super testing users web webmail
- 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 Firefox Help (JavaScript / DHTML / AJAX)
- 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


Linear Mode