User Name Password Register
DaniWeb IT Discussion Community
All
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 391,929 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,685 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: 2054 | Replies: 18 | Solved
Reply
Join Date: Jul 2008
Posts: 9
Reputation: chellethecat is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
chellethecat chellethecat is offline Offline
Newbie Poster

Script works in IE, but not in Firefox

  #1  
Jul 14th, 2008
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.

<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">
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2008
Posts: 108
Reputation: Thirusha is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 12
Thirusha Thirusha is offline Offline
Junior Poster

Re: Script works in IE, but not in Firefox

  #2  
Jul 15th, 2008
Have u tried using firefox's firebug?

I copied the code u provided and it doesnt work because DynLayerInit is undefined, i suspect it is in the dynlayer.js file. which u havent provided.

Please provide the other js files as well, it would help alot.
Reply With Quote  
Join Date: Jul 2008
Posts: 9
Reputation: chellethecat is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
chellethecat chellethecat is offline Offline
Newbie Poster

Re: Script works in IE, but not in Firefox

  #3  
Jul 15th, 2008
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()
Attached Files
File Type: js miniscroll.js (1.5 KB, 4 views)
File Type: js dynlayer.js (7.9 KB, 3 views)
Reply With Quote  
Join Date: Mar 2008
Posts: 108
Reputation: Thirusha is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 12
Thirusha Thirusha is offline Offline
Junior Poster

Re: Script works in IE, but not in Firefox

  #4  
Jul 16th, 2008
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
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.
Reply With Quote  
Join Date: Jun 2008
Posts: 65
Reputation: Troy III is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 10
Troy III's Avatar
Troy III Troy III is offline Offline
Junior Poster in Training

Re: Script works in IE, but not in Firefox

  #5  
Jul 16th, 2008
Please try:
<!--
function init() {
        DynLayerInit()        
	myscroll = new MiniScroll("scrollWindowDiv", "scrollContentDiv")
}
//-->

Regards
Reply With Quote  
Join Date: Jul 2008
Posts: 9
Reputation: chellethecat is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
chellethecat chellethecat is offline Offline
Newbie Poster

Re: Script works in IE, but not in Firefox

  #6  
Jul 16th, 2008
Thirusha, I tried what you suggested however I didn't notice a change - in IE or Firefox.

Originally Posted by Troy III View Post
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).
Reply With Quote  
Join Date: Jun 2008
Posts: 65
Reputation: Troy III is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 10
Troy III's Avatar
Troy III Troy III is offline Offline
Junior Poster in Training

Re: Script works in IE, but not in Firefox

  #7  
Jul 17th, 2008
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.
Reply With Quote  
Join Date: Jul 2008
Posts: 9
Reputation: chellethecat is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
chellethecat chellethecat is offline Offline
Newbie Poster

Re: Script works in IE, but not in Firefox

  #8  
28 Days Ago
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.
Reply With Quote  
Join Date: Mar 2008
Posts: 108
Reputation: Thirusha is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 12
Thirusha Thirusha is offline Offline
Junior Poster

Re: Script works in IE, but not in Firefox

  #9  
28 Days Ago
In the miniscroll.js replace the following lines
this.contentHeight = (is.ns)? this.content.doc.height : this.content.elm.scrollHeight
this.contentWidth = (is.ns)? this.content.doc.width : this.content.elm.scrollWidth
with this
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.
Reply With Quote  
Join Date: Jul 2008
Posts: 9
Reputation: chellethecat is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
chellethecat chellethecat is offline Offline
Newbie Poster

Re: Script works in IE, but not in Firefox

  #10  
27 Days Ago
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.
Last edited by chellethecat : 27 Days Ago at 4:15 pm. Reason: Clarification
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 8:23 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC