Avatar billede gadebarnet Nybegynder
22. april 2005 - 10:42 Der er 2 kommentarer

script hjælp, scroll vertikalt trækker

Jeg har bakset dette sammen med hjælpe fra eksperten.dk.

Men jeg forstår ikke hvad der sker til sidst...

Alle de tabeler jeg har proppet ind, er bare for at lave fylde så der er noget at scrolle med...

Men når det kommer helt ud, så trækker den... eller... ja, jeg ved sku ikke hvad der er galt... Hvis der er nogle der har et andet script der virker bedre, så er jeg meget glad.

---

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD><TITLE></TITLE>
<META NAME="Generator" CONTENT="">
<style type="text/css"> 
#divLeftControl{position:absolute; width:160; left:10; top:80; z-index:1; text-align: left}
#divRightControl{position:absolute; width:160; left:370; top:80; z-index:1; text-align: right}
#divContainer{position:absolute; width:558; height:100; overflow:hidden; top:0; left:0; clip:rect(0,558,100,0); visibility:hidden;}
#divContent{position:absolute; top:55; left:0; visibility:visible; }
</style>
<script language="JavaScript">// begin absolutely positioned scrollable area object scripts
/*
Extension developed by David G. Miles (www.z3roadster.net/dreamweaver)
Original Scrollable Area code developed by Thomas Brattli
To add more shock to your site, visit www.DHTML Shock.com
*/
var debugActive = true;
function debug( txt ) {
    if ( debugActive ) debugActive=confirm( txt );
}; //end debug( string )


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=10

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.scrollWidth=bw.ns4
                    ? this.css.document.width
                    : this.el.offsetWidth;
    this.clipWidth=bw.ns4
                  ? this.css.clip.width
                  : this.el.offsetWidth;
    this.leftx= MoveAreaLeft;
    this.rightx=MoveAreaRight;
    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 MoveAreaRight(move){
//  debug ( "MoveAreaRight("+move+") kaldt. this.x = " +this.x );
//  debug ( "bredde "+ 320 +" -" +this.scrollWidth );
//    if(this.x>objContainer.clipWidth-this.scrollWidth){
    if(this.x>320-this.scrollWidth){
    this.MoveArea(this.x-move,0)
    if(loop) setTimeout(this.obj+".rightx("+move+")",speed)
    }
}
function MoveAreaLeft(move){
//  debug ( "MoveAreaLeft("+move+") kaldt. this.x = " +this.x );
    if(0>this.x){
    this.MoveArea(this.x-move,0)
    if(loop) setTimeout(this.obj+".leftx("+move+")",speed)
    }
}

function PerformScroll(speed){
//  debug ( "PerformScroll("+speed+") kaldt" );
    if(initialised){
        loop=true;
        if(speed>0) objScroller.rightx(speed)
        else objScroller.leftx(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>

</HEAD>
<body onLoad="InitialiseScrollableArea()">

<!-- begin absolutely positioned scrollable area object-->
<div id="divLeftControl"> <a href="java script:;" onMouseOver="PerformScroll(-7)" onMouseOut="CeaseScroll()">[scroll
  left]</a> </div>
<div id="divRightControl"> <a href="java script:;" onMouseOver="PerformScroll(7)" onMouseOut="CeaseScroll()">[scroll
  right]</a> </div>
<div id="divContainer">
  <div id="divContent">
<table width='100%'><tr><td width=150 height=20 bgcolor=red>1</td><td width=150 height=20 bgcolor=red>2</td><td width=150 height=20 bgcolor=red>3</td><td width=150 height=20 bgcolor=red>4</td><td width=150 height=20 bgcolor=red>5</td><td width=150 height=20 bgcolor=red>6</td><td width=150 height=20 bgcolor=red>7</td><td width=150 height=20 bgcolor=red>8</td><td width=150 height=20 bgcolor=red>9</td><td width=150 height=20 bgcolor=red>10</td><td width=150 height=20 bgcolor=red>11</td><td width=150 height=20 bgcolor=red>12</td><td width=150 height=20 bgcolor=red>13</td><td width=150 height=20 bgcolor=red>14</td><td width=150 height=20 bgcolor=red>15</td><td width=150 height=20 bgcolor=red>16</td><td width=150 height=20 bgcolor=red>17</td><td width=150 height=20 bgcolor=red>18</td><td width=150 height=20 bgcolor=red>19</td><td width=150 height=20 bgcolor=red>20</td><td width=150 height=20 bgcolor=red>21</td><td width=150 height=20 bgcolor=red>22</td><td width=150 height=20 bgcolor=red>23</td><td width=150 height=20 bgcolor=red>24</td><td width=150 height=20 bgcolor=red>25</td><td width=150 height=20 bgcolor=red>26</td><td width=150 height=20 bgcolor=red>27</td><td width=150 height=20 bgcolor=red>28</td><td width=150 height=20 bgcolor=red>29</td><td width=150 height=20 bgcolor=red>30</td><td width=150 height=20 bgcolor=red>31</td><td width=150 height=20 bgcolor=red>32</td><td width=150 height=20 bgcolor=red>33</td><td width=150 height=20 bgcolor=red>34</td><td width=150 height=20 bgcolor=red>35</td><td width=150 height=20 bgcolor=red>36</td><td width=150 height=20 bgcolor=red>37</td><td width=150 height=20 bgcolor=red>38</td><td width=150 height=20 bgcolor=red>39</td><td width=150 height=20 bgcolor=red>40</td><td width=150 height=20 bgcolor=red>41</td><td width=150 height=20 bgcolor=red>42</td><td width=150 height=20 bgcolor=red>43</td><td width=150 height=20 bgcolor=red>44</td><td width=150 height=20 bgcolor=red>45</td><td width=150 height=20 bgcolor=red>46</td><td width=150 height=20 bgcolor=red>47</td><td width=150 height=20 bgcolor=red>48</td><td width=150 height=20 bgcolor=red>49</td><td width=150 height=20 bgcolor=red>50</td></tr></table>
   
  </div>
</div>
<!-- end absolutely positioned scrollable area object -->
</BODY>
</HTML>



---
Avatar billede psykochicken Nybegynder
22. april 2005 - 18:36 #1
prøv at kigge på http://rod.rant-on.net/ :)
Avatar billede psykochicken Nybegynder
22. april 2005 - 18:52 #2
eller prøv at fjerne width og height fra tabel og celler :)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester