-
HTML error?
I am getting a strange Error message from my site saying that there is "Object Required".
Here is the section of code it is referring to (the section in bold is the area it said is the problem.):
nest=(!nest) ? '':'document.'+nest+'.'
this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
this.up=MoveAreaUp;this.down=MoveAreaDown;
this.MoveArea=MoveArea; this.x; this.y;
this.obj = obj + "Object"
eval(this.obj + "=this")
return this
Any clues?
-
is css (this.css) something you created as a class? because i was unaware of that method
-
I believe that it was... but this error is the only error on the site... its just bugging me and I don't know what it is.... :(
-
hmmm...it's kind of hard to tell, because it looks like you have several elements from different classes interacting together, and it is hard to see the foundations of the classes without the code. :(
-
I will put up the code for the page in about 2 - 3 hours as my machine is currently being used in a meeting (as it is the most powerful machine in the building - I built it myself). But when it comes back I will post the whole page of code so you can have a look.... it is really puzzling me.. :confused:
-
Here is the code for the entire page......... I dont know what is wrong.... I hope that someone can see where this chuffing error is coming from.
<html>
<head>
<title>Welcome to Medical Marketing Research</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body{font-family:Arial;}
#divUpControl{position:absolute; width:320; left:10; top:10; z-index:1; text-align: right}
#divDownControl{position:absolute; width:320; left:10; top:270; z-index:1; text-align: right}
#divContainer{position:absolute; width:320; height:240; overflow:hidden; top:30; left:10; clip:rect(0,320,240,0); visibility:hidden}
#divContent{position:absolute; top:0; left:0}
</style>
<SCRIPT LANGUAGE="JavaScript1.2" SRC="javascripts/menu.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2" SRC="javascripts/mymenus.js"></SCRIPT>
<script language="JavaScript">
function verifyCompatibleBrowser(){
this.ver=navigator.appVersion
this.dom=document.getElementById?1:0
this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
this.ie4=(document.all && !this.dom)?1:0;
this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
return this
}
bw=new verifyCompatibleBrowser()
var speed=50
var loop, timer
function ConstructObject(obj,nest){
nest=(!nest) ? '':'document.'+nest+'.'
this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
this.up=MoveAreaUp;this.down=MoveAreaDown;
this.MoveArea=MoveArea; this.x; this.y;
this.obj = obj + "Object"
eval(this.obj + "=this")
return this
}
function MoveArea(x,y){
this.x=x;this.y=y
this.css.left=this.x
this.css.top=this.y
}
function MoveAreaDown(move){
if(this.y>-this.scrollHeight+objContainer.clipHeight){
this.MoveArea(0,this.y-move)
if(loop) setTimeout(this.obj+".down("+move+")",speed)
}
}
function MoveAreaUp(move){
if(this.y<0){
this.MoveArea(0,this.y-move)
if(loop) setTimeout(this.obj+".up("+move+")",speed)
}
}
function PerformScroll(speed){
if(initialised){
loop=true;
if(speed>0) objScroller.down(speed)
else objScroller.up(speed)
}
}
function CeaseScroll(){
loop=false
if(timer) clearTimeout(timer)
}
var initialised;
function InitialiseScrollableArea(){
objContainer=new ConstructObject('divContainer')
objScroller=new ConstructObject('divContent','divContainer')
objScroller.MoveArea(0,0)
objContainer.css.visibility='visible'
initialised=true;
}
// end absolutely positioned scrollable area object scripts
</script>
<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="InitialiseScrollableArea()" background="images/welcomeside.jpg" link="#FFFFFF">
<div id="Layer1" style="position:absolute; width:200px; height:115px; z-index:-1; left: -3px; top: 27px"><img src="images/speechbubbles.gif" width="752" height="494" usemap="#Map" border="0">
<map name="Map">
<area shape="rect" coords="325,78,596,148" href="opex.asp" target="main">
<area shape="rect" coords="79,136,324,197" href="background.asp" target="main">
<area shape="rect" coords="35,282,268,376" href="advise.asp" target="main">
<area shape="rect" coords="514,197,699,287" href="http://www.tpi-courses.com" target="_blank">
</map>
</div>
<div id="Layer2" style="position:absolute; width:145px; height:115px; z-index:3; left: 312px; top: 316px">
<div align="left"><a href="#"><img src="images/mascot.gif" width="159" height="141" border="0" onClick="javascript:window.open('flash/asteroids.swf',menubar='no',status='no',toolbar='no')";
></a></div>
</div>
</body>
<script language="JavaScript">
<!--
//For IE
if (document.all) {
loadMenus();
}
//-->
</script>
</html>
-
Noone? Does anyone know why there is an Error on this page?
-
if I run that code I will get the error?? nope it runs just fine for me. I am using IE5.0 as well. do I have to click on anything or just wait until it pops up :D
never mind I found it. let me get back to ya :D stupid me
-
ok look at this and tell me what is wrong with it.
Code:
return this
}
bw=new verifyCompatibleBrowser() {
var speed=50
var loop, timer
}
function ConstructObject(obj,nest){
nest=(!nest) ? '':'document.'+nest+'.'
I added the bold brackets and it runs fine, except I think I get the error for the javascript menu not being there.
now I don't know if there are suppose to be there but I don't get that error any more from that line. try that and let me know. :)
-
Cheers Scoutt... Well I also no longer get the error from that line... Instead it has moved to line 99 Character 1 with another expected object....
The line that starts the image map of the image that is in a layer... Could it be the image i'm using or the image maps?
-
I got that one as well, I though it was becasue I didn't have the menu scripts. well back to the drawing board. I look at it later again in more detail.
-
have you tried running that in NS? without the fix I did, only the original code you supplied, this is what netscape said.
Code:
JavaScript Error: line 37:
this.css has no properties.
and the line is this one.
this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
I am not too familiar with javascript, at this extreme, so I can only suggest hints. maybe some one else that knoes javascript can help as I am out of options. sorry bud. :rolleyes:
I suspect IE is saying the same thing.
-
Oh dear... :(
I think some of these good people seem to be on a wild goose chase trying to solve this one ;)
You have several obvious mistakes, and a few more subtle ones:
1. Did it not strike anyone as odd that chris has got the style definitions for "divContainer" and "divContent" but no layers with these id's? :confused: Also- another clue is in the code:
Code:
objContainer=new ConstructObject('divContainer')
objScroller=new ConstructObject('divContent','divContainer')
This is trying to reference elements with these id's on the page, but the only <div> tags have the id's "Layer1" and "Layer2". That is why the "object expected" type errors are happening.
Assuming you want your scrollable region to be in "Layer2", then change the id of this layer to "divContent" and the id of "Layer1" to "divContainer".
2. Don't you want any buttons for people to be able to scroll with?
This code defines two <div> elements with the id's "divUpControl" and "divDownControl" in the style block at the top. If you use them, these elements should contain the images that you want to use as up and down arrows.
But.. you can get away without using these if you want to position your arrows differently.
Each image should be contained in an <a> tag that call the relevant javascript code for the "onMouseOver" and "onMouseOut" events.
For example:
Code:
<a href="#" onmouseover="PerformScroll(-5)" onmouseout="CeaseScroll()"><img src="up.gif"></a>
<a href="#" onmouseover="PerformScroll(5)" onmouseout="CeaseScroll()"><img src="down.gif"></a>
3. Also - the "onClick" event of the <img> that launches "flash/asteroids.swf" does not need the protocol "java script:" in front of the code (if it was needed, the protocol should actually be "javascript:" - one word).
Events assume that you are using javascript as your scripting language anyway.
Hope this is of some help. :)
-
Cheers for your help benski.. I will have a good look at what you have said and the code.. and hopefully we will crack this problem.