---
title: "Js error!"
type: "forum-thread"
url: "https://www.webforum.nu/amne/javascript/18109-js-error"
topic: "JavaScript"
topic_url: "https://www.webforum.nu/amne/javascript"
author: "annesophie"
published: "2001-08-15T12:31:00.000Z"
updated: "2001-08-15T21:16:00.000Z"
replies: 4
views: 362
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/javascript/18109-js-error"
---

# Js error!

## #1 — annesophie, 2001-08-15T12:31Z

Hej,

Är nu efter en hel dags febrilt felletande DESPERAT! Jag hoppas och ber att det ska finnas någon vis person här som vet vad som är fel på en av mina min sidor. Har en sida där det finns två javascript. Båda scripten funkar var för sig, men inte tillsammans. \*suck\*

Då jag lägger dom tillsammans får jag felmeddelande:

\----
Row: 46
Character: 5
document.all.tooltip2.style is not an object
\-----

Jag vet inte vad som är fel!!! 

Det första scriptet innehåller en funktion som gör att när man för musen över ett visst ord (som i detta fallet är \<%=rs2("dictionary_word")%\> ) så ska ett lager visa sig som då innehåller \<%=rs2("dictionary_explanation")%\> .

Det andra scriptet är en scroll som scrollar flera "sidor" (lager).

Dom funkar som sagt utmärkt var och en för sig - men inte tillsammans. Några förslag på vad som är fel?

\*hoppas\*

MvH

/A

Här kommer jätte massa kod!!!!

\----

\<%
option explicit
response.buffer=true

dim conn,sql,rs,sql2,rs2,x,farg

set conn = Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (\*.mdb)};dbq="& server.mappath("tcf.mdb")

sql = "SELECT \* FROM \[tcf_price\] ORDER BY tcf_price_id DESC ;"
set rs = conn.execute(sql)

sql2 = "SELECT \* FROM \[dictionary\] ORDER BY dictionary_id DESC ;"
set rs2 = conn.execute(sql2)
%\>

\<HTML\>

\<HEAD\>

\<link rel="stylesheet" type="text/css" href="css.css"\>

\<style type="text/css"\>
a {font-family:verdana,arial,helvetica,sans-serif; font-size:11px; color:#666666; text-decoration:none;}
a:hover {text-decoration:underline; color:#cccccc;}
body {overflow:hidden; border-left-width:0px; border-right-width:0px; color:#999999; font-size:11px; font-family:verdana,arial,helvetica,sans-serif; line-height:130%;}

\#divScroller1 {position:absolute; overflow:hidden; z-index:9; left:100px; top:50px; width:400px; height:300px; clip:rect(0px, 400px, 300px, 0px); visbility:visible; border-width:0px 0px 0px 1px; border-color:#808080; border-style:dashed;}
.dynPage {position:absolute; z-index:10; left:0px; top:0px; width:300px; visibility:hidden; padding-left:15px; font-family:arial,helvetica,sans-serif; font-size:11px; color:black}
\#arrows {position:absolute; z-index:11; left:74px; top:315px; width:20px;}
\#links {position:absolute; z-index:11; left:22px; top:270px; width:20px;} 
\</style\>

\<SCRIPT LANGUAGE="JavaScript"\>

//HAR BORJAR KODEN SOM INTE VILL FUNKA

\<!-- 
function showtip2(current,e,text){
  if (document.all&&document.readyState=="complete"){
    document.all.tooltip2.innerHTML='\<marquee style="border:1px solid black"\>'+text+'\</marquee\>'
    document.all.tooltip2.style.pixelLeft=event.clientX+document.body.scrollLeft+10
    document.all.tooltip2.style.pixelTop=event.clientY+document.body.scrollTop+10
    document.all.tooltip2.style.visibility="visible"
}
  else if (document.layers){
    document.tooltip2.document.nstip.document.write('\<b\>'+text+'\</b\>')
    document.tooltip2.document.nstip.document.close()
    document.tooltip2.document.nstip.left=0
    currentscroll=setInterval("scrolltip()",100)
    document.tooltip2.left=e.pageX+10
    document.tooltip2.top=e.pageY+10
    document.tooltip2.visibility="show"
}
}
function hidetip2(){
  if (document.all)
    document.all.tooltip2.style.visibility="hidden"
    else if (document.layers){
    clearInterval(currentscroll)
    document.tooltip2.visibility="hidden"
}
}
//  End --\>

// HAR SLUTAR KODEN SOM INTE VILL FUNKA

function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")\>-1
	this.ie5=(this.ver.indexOf("MSIE 5")\>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")\>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4&#0124;&#0124;this.ie5&#0124;&#0124;this.ie6
	this.mac=this.agent.indexOf("Mac")\>-1
	this.ns6=(this.dom && parseInt(this.ver) \>= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 &#0124;&#0124; this.ie5 &#0124;&#0124; this.ie4 &#0124;&#0124; this.ns4 &#0124;&#0124; this.ns6 &#0124;&#0124; this.opera5)
	return this
}
var bw=new lib_bwcheck()

/\*\*\* variables to configure... \*\*\*/

var numScrollPages = 3         //Set the number of pages (layers) here.
var transitionOut = 1;         //The 'out' effect... 0= no effect, 1= fade
var transitionIn = 2;          //The 'in' effect... 0= no effect, 1= fade, 2= slide
var slideAcceleration = 0.2;   //If you use the slide animation, set this somewhere between 0 and 1.

/\*\*\* Please note that there are no effects available in ns4 and ie4, or explorers on the Mac! \*\*\*/

if(document.layers){ //NS4 resize fix...
	scrX= innerWidth; scrY= innerHeight;
	onresize= function(){if(scrX!= innerWidth &#0124;&#0124; scrY!= innerHeight){history.go(0)} }
}

//object constructor...
function scrollerobj(obj,nest){
	nest = (!nest)?"":'document.'+nest+'.'
	this.elm = bw.ie4?document.all\[obj\]:bw.ns4?eval(nest+'document.'+obj):document.getElementById(obj)
	this.css = bw.ns4?this.elm:this.elm.style
	this.doc = bw.ns4?this.elm.document:document
	this.obj = obj+'scrollerobj'; eval(this.obj+'=this')
	this.x = (bw.ns4&#0124;&#0124;bw.opera5)?this.css.left:this.elm.offsetLeft
	this.y = (bw.ns4&#0124;&#0124;bw.opera5)?this.css.top:this.elm.offsetTop
	this.w = (bw.ie4&#0124;&#0124;bw.ie5&#0124;&#0124;bw.ie6&#0124;&#0124;bw.ns6)?this.elm.offsetWidth:bw.ns4?this.elm.clip.width:bw.opera5?this.css.pixelWidth:0
	this.h = (bw.ie4&#0124;&#0124;bw.ie5&#0124;&#0124;bw.ie6&#0124;&#0124;bw.ns6)?this.elm.offsetHeight:bw.ns4?this.elm.clip.height:bw.opera5?this.css.pixelHeight:0
}

//object methods...
scrollerobj.prototype.moveTo = function(x,y){
	if(x!=null){this.x=x; this.css.left=x}
	if(y!=null){this.y=y; this.css.top=y}
}
scrollerobj.prototype.moveBy = function(x,y){this.moveTo(this.x+x,this.y+y)}
scrollerobj.prototype.hideIt = function(){this.css.visibility='hidden'}
scrollerobj.prototype.showIt = function(){this.css.visibility='visible'}

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
scroll functions...
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/
var scrollTimer = null;
function scroll(step){
	clearTimeout(scrollTimer);
	if ( !busy && (step\<0&&activePage.y+activePage.h\>scroller1.h &#0124;&#0124; step\>0&&activePage.y\<0) ){
		activePage.moveBy(0,step);
		scrollTimer = setTimeout('scroll('+step+')',40);
	}
}
function stopScroll(){
	clearTimeout(scrollTimer);
}

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
activating the correct layers...
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/
var activePage = null;
var busy = 0;
function activate(num){
	if (activePage!=pages\[num\] && !busy){
		busy = 1;
		if (transitionOut==0 &#0124;&#0124; !bw.opacity){ activePage.hideIt(); activateContinue(num); }
		else if (transitionOut==1) activePage.blend('hidden', 'activateContinue('+num+')');
	}
}
function activateContinue(num){
	busy = 1;
	activePage = pages\[num\];
	activePage.moveTo(0,0);
	if (transitionIn==0 &#0124;&#0124; !bw.opacity){ activePage.showIt(); busy=0; }
	else if (transitionIn==1) activePage.blend('visible', 'busy=0');
	else if (transitionIn==2) activePage.slide(0, slideAcceleration, 40, 'busy=0');
}

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
Slide methods...
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/
scrollerobj.prototype.slide = function(target, acceleration, time, fn){
	this.slideFn= fn?fn:null;
	this.moveTo(0,scroller1.h);
	if (bw.ie4&&!bw.mac) this.css.filter = 'alpha(opacity=100)';
	if (bw.ns6) this.css.MozOpacity = 1;
	this.showIt();
	this.doSlide(target, acceleration, time);
}
scrollerobj.prototype.doSlide = function(target, acceleration, time){
	this.step = Math.round(this.y\*acceleration);
	if (this.step\<1) this.step = 1;
	if (this.step\>this.y) this.step = this.y;
	this.moveBy(0, -this.step);
	if (this.y\>0) this.slideTim = setTimeout(this.obj+'.doSlide('+target+','+acceleration+','+time+')', time);
	else {	
		eval(this.slideFn);
		this.slideFn = null;
	}
}

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
Opacity methods...
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/
scrollerobj.prototype.blend= function(vis, fn){
	if (bw.ie5&#0124;&#0124;bw.ie6 && !bw.mac) {
		if (vis=='visible') this.css.filter= 'blendTrans(duration=0.9)';
		else this.css.filter= 'blendTrans(duration=0.6)';
		this.elm.onfilterchange = function(){ eval(fn); };
		this.elm.filters.blendTrans.apply();
		this.css.visibility= vis;
		this.elm.filters.blendTrans.play();
	}
	else if (bw.ns6 &#0124;&#0124; bw.ie&&!bw.mac){
		this.css.visibility= 'visible';
		vis=='visible' ? this.fadeTo(100, 7, 40, fn) : this.fadeTo(0, 9, 40, fn);
	}
	else {
		this.css.visibility= vis;
		eval(fn);
	}
};

scrollerobj.prototype.op= 100;
scrollerobj.prototype.opacityTim= null;
scrollerobj.prototype.setOpacity= function(num){
	this.css.filter= 'alpha(opacity='+num+')';
	this.css.MozOpacity= num/100;
	this.op= num;
}
scrollerobj.prototype.fadeTo= function(target, step, time, fn){
	clearTimeout(this.opacityTim);
	this.opacityFn= fn?fn:null;
	this.op = target==100 ? 0 : 100;
	this.fade(target, step, time);
}
scrollerobj.prototype.fade= function(target, step, time){
	if (Math.abs(target-this.op)\>step){
		target\>this.op? this.setOpacity(this.op+step):this.setOpacity(this.op-step);
		this.opacityTim= setTimeout(this.obj+'.fade('+target+','+step+','+time+')', time);
	}
	else {
		this.setOpacity(target);
		eval(this.opacityFn);
		this.opacityFn= null;
	}
}

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
Init function...
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/
var pageslidefadeLoaded = 0;
function initPageSlideFade(){
	scroller1 = new scrollerobj('divScroller1');
	
	pages = new Array();
	pages\[0\] = null;
	for (var i=1; i\<=numScrollPages; i++){
		pages \= new scrollerobj('dynPage'+i, 'divScroller1');
		pages.moveTo(0,0);
	}
	bw.opacity = ( bw.ie && !bw.ie4 && navigator.userAgent.indexOf('Windows')\>-1 ) &#0124;&#0124; bw.ns6
	if (bw.ie5&#0124;&#0124;bw.ie6 && !bw.mac) pages\[1\].css.filter= 'blendTrans(duration=0.6)'; // Loads the windows 9.x filters module.
	activateContinue(1);

	if (bw.ie) for(var i=0;i\<document.links.length;i++) document.links.onfocus=document.links.blur;
	pageslidefadeLoaded = 1;
}
//if the browser is ok, the script is started onload..
if(bw.bw && !pageslidefadeLoaded) onload = initPageSlideFade;
\</script\>

\</HEAD\>

\<BODY marginwidth="0" marginheight="0" leftmargin="0" topmargin="2" cellspacing="0" cellpadding="0"\>

\<table width="449" border="0" bgcolor="white" height="374" class=bildtva border="0" cellspacing="0" cellpadding="0"\>

		\<tr\>
			\<td valign="top" align="top" height="30"\> 
				\<img src="images/logo.jpg"\>
			\</td\>
		\</tr\>

		\<tr\>
			\<td\>
			
				\<div id="divScroller1"\>
	
					\<div id="dynPage1" class="dynPage"\>

						\<h5\>So what about prices?\</h5\>
							\<%=rs("tcf_price_general")%\>

					\</div\>

					\<div id="dynPage2" class="dynPage"\>
	
						\<%=rs("tcf_alternative1")%\>\<br\>
						\<%=rs("tcf_contact")%\>\<br\>
							\<a href="mailto:tellmemore@thecookiefactory.nu"\>\<%=rs("tcf_contact_email")%\>\</a\>\<br\>
								\<br\>\<br\>
							\<a href="#" onclick="activate(1); return false;" onfocus="if(this.blur)this.blur()"\> \<\< Back\</a\>
								\<br\>\<br\>
						\<%=rs("tcf_alternative2")%\>\<br\>
						\<%=rs("tcf_contact")%\>
							\<a href="mailto:tellmemore@thecookiefactory.nu"\>\<%=rs("tcf_contact_email")%\>\</a\>\<br\>
								\<br\>\<br\>
							\<a href="#" onclick="activate(1); return false;" onfocus="if(this.blur)this.blur()"\> \<\< Back\</a\>
								\<br\>\<br\>
						\<%=rs("tcf_alternative3")%\>\<br\>
						\<%=rs("tcf_contact")%\>
							\<a href="mailto:tellmemore@thecookiefactory.nu"\>\<%=rs("tcf_contact_email")%\>\</a\>\<br\>
								\<br\>\<br\>
							\<a href="#" onclick="activate(1); return false;" onfocus="if(this.blur)this.blur()"\> \<\< Back\</a\>
								\<br\>\<br\>
						\<%=rs("tcf_alternative4")%\>\<br\>
						\<%=rs("tcf_contact")%\>
							\<a href="mailto:tellmemore@thecookiefactory.nu"\>\<%=rs("tcf_contact_email")%\>\</a\>\<br\>
								\<br\>\<br\>
							\<a href="#" onclick="activate(1); return false;" onfocus="if(this.blur)this.blur()"\> \<\< Back\</a\>
								\<br\>\<br\>
						\<%=rs("tcf_alternative5")%\>\<br\>
						\<%=rs("tcf_contact")%\>
							\<a href="mailto:tellmemore@thecookiefactory.nu"\>\<%=rs("tcf_contact_email")%\>\</a\>\<br\>
							\<a href="#" onclick="activate(1); return false;" onfocus="if(this.blur)this.blur()"\> \<\< Back\</a\>
								\<br\>\<br\>
					\</div\>

					\<div id="dynPage3" class="dynPage"\>

						\<table border="0" width="300"\>
		
							\<tr\>
								\<td colspan="2" width="300"\>\<h5\>Dictionary\</h5\>\</td\>
							\</tr\>
						\<%
						sql2 = "SELECT \* FROM \[dictionary\] ORDER BY dictionary_id DESC ;"
						set rs2 = conn.execute(sql2)

						x=0
						do until rs2.EOF OR rs2.BOF
	
						IF x=0 THEN
							farg="#f0f0f0"
							x=x+1
						ELSE
							x=1
							farg="white"
							x=x-1
						END IF		
						%\>
							\<tr\>
								\<td colspan="2" width="200"\>
	
									\<div id="tooltip2" style="position:absolute;visibility:hidden;clip:rect(0 150 50 0);width:150px;background-color:gold;z-index:10"\>\</div\>
									\<div align="CENTER" name="divTest" onMouseover="showtip2(this,event,'\<%=rs2("dictionary_explanation")%\>');" onMouseout="hidetip2();" STYLE="cursor: hand"\>
										\<b\>\<%=rs2("dictionary_word")%\>\</b\>\</div\>
								\</td\>
							\</tr\>
							\<tr\>
								\<td width="10"\> \</td\>
								\<td width="290"\>\<%=rs2("dictionary_explanation")%\>\</td\>
							\</tr\>
						\<%		
						rs2.MoveNext
						loop
						%\>

					\</table\>

	\<a href="#" onclick="activate(1); return false;" onfocus="if(this.blur)this.blur()"\> \<\< Back\</a\>
		\<br\>\<br\>

	\</div\>

	\</div\>

\<div id="arrows"\>
	\<a href="#" onclick="return false;" onmouseover="scroll(7);" onmouseout="stopScroll();"\>\<img src="images/litenpilupp.jpg"  alt="" border="0"\>\</a\>
	\<a href="#" onclick="return false;" onmouseover="scroll(-7);" onmouseout="stopScroll();"\>\<img src="images/litenpilner.jpg"  alt="" border="0"\>\</a\>
\</div\>

\<div id="links"\>
	\<a href="#" onclick="activate(2); return false;" onfocus="if(this.blur)this.blur()"\>Examples\</a\>\<br\>
	\<a href="#" onclick="activate(3); return false;" onfocus="if(this.blur)this.blur()"\>Dictionary\</a\>\<br\>
\</div\>
			\</td\>
		\</tr\>
		\<tr\>
			\<td height="200" align="bottom" halign="bottom" valign="bottom"\>\<a href="#" onclick="setWindows(); return false"\>\<font color="white"\>reset windows\</font\>\</a\>\</td\>
		\</tr\>
\</table\>

\</BODY\>

\</HTML\>

\----

\[Redigerat av annesophie den 15 aug 2001\]

Permalänk: https://www.webforum.nu/p/18109

## #2 — CokeLight, 2001-08-15T15:08Z

Hej annesophie,

> Båda scripten funkar var för sig, men inte tillsammans.

Vilka menar du då...? showtip2 & hidetip2 eller..? När jag provade de tillsammans med din "tooltip" \<div\> så gick det... (Jag bytte ut ASP:n mot statisk text). Är det någon annan funktion som krockar med dem menar du, eller...?

Annars vet jag inte vad som är fel.. prova kanske att köra minimum kod och lägg på kod vartefter så ser du kanske var det kör ihop sig..?

Permalänk: https://www.webforum.nu/p/334137

## #3 — annesophie, 2001-08-15T16:33Z

Vad skumt! När jag testar allt tillsammans så funkar scrollern men inte min showtip2 (och då naturligtvis inte hidetip2 heller). Jag får bara felmeddelandet som jag skrev i mitt första inlägg....mmm....

Så allt du gjorde var att byta ut ASP till statisk text??? Inget annat? \*förvånad\* varför funkar det inte för mig dååååå \*suckar\*

Help!

MvH

/A

Permalänk: https://www.webforum.nu/p/334138

## #4 — CokeLight, 2001-08-15T17:10Z

Eftersom felet pekade på document.all så plockade jag även bort Netscape varianten, och ALLT annat förutom din \<div id="tooltip2"\> och då fungerar både hide & show... därför tänkte jag att du kanske kunde felsöka genom att börja med de två grundfunktionerna bara, och sen successivt lägga på ASP och tabeller.. 

Om din "tooltip2"-div inte är ett obj. i din kod så kanske det beror på att den blivit felnästlad kanske eller nåt sånt, och därför inte syns.. 

Hoppas det löser sig :)

Permalänk: https://www.webforum.nu/p/334139

## #5 — annesophie, 2001-08-15T21:16Z

Hej igen,

...ja det är väl bara att börja från början och ta bort och lägga till!

Tack ändå...

MvH

/A

Permalänk: https://www.webforum.nu/p/334140

---

Tråden på webben: https://www.webforum.nu/amne/javascript/18109-js-error
