Re: für was brauch ich einen Schieberegler?

Hallo,

ich habe eine Frage. Ich habe den Code von dem Ferbregler Vers. 2 gestern ca. 1 Stunde nur verändert, aber mein Ergebniss war nicht gerade sehr gut. Ich wollte Den Code von all diesen Rahmen "befreien". Dann sollte ich mit den Schiebereglern eine einzelne Hintergrundfarbe eines Wortes ändern können. Nur leider habe ich das wiegesagt nicht geschafft. Wie könnte ich es machen???

27

Re: für was brauch ich einen Schieberegler?

Moin,

ich weiß nicht, was und wie Du geändert hast, weswegen
ich mir keine Vorstellung von Deinen Schwierigkeiten
machen kann.
Im folgenden nochmal ein kleines script. Wenn Du auf einen
tag clickst, erscheint ein Farbregler.  Sobald Du in einem
der Farbfelder die mouse drückst und ziehst,  ändert sich
der jeweilige Farbanteil des vorher ausgesuchten tags.

IE6, NN7, opera7

 

 
 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
 <html>
 <head>
 <title>div_IE6_NN7_OP7</title>
 <meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>
 <style type="text/css">
 div{position:absolute;font-Size:0px;cursor:default;};
 </style>
 <script type='text/javascript'>
 
 function INIT()
 {M(D('holla'),F,178,FF,'verdana',L,300,T,200);
  M(D('hoppsassa'),F,69,FF,'courier',L,500,T,100);
  M(D('haschmisch'),F,34,FF,'impact',L,150,T,450,C,'#aa3388');
 
  //wenn Du ab hier etwas änderst, mußt Du wissen, was Du tust
 
  B(D('buddyholly'),RGB(255,255,255));
  M(D('divv'),T,20,W,120,H,310,V,0,B,'gray',P,1);
  M(D('x'),W,12,H,12,B,'#aa0000',T,2,L,106);
  M(D('bu'),F,13,FF,'verdana',W,120,H,33,B,'#666666');
  M(D('r'),H,258,L,15,T,40,P,0);
  M(D('g'),H,258,L,50,T,40,P,0);
  M(D('b'),H,258,L,85,T,40,P,0);
  M(D('zr'),W,7,H,2,L,8,T,40,B,'black');
  M(D('zg'),W,7,H,2,L,43,T,40,B,'black');
  M(D('zb'),W,7,H,2,L,78,T,40,B,'black');
  dy=T(D('r')); br=dy+T(D('divv'))+(da&&!wo?17:8);
 };
 
 var d=document, da=d.all, wo=window.opera, machhin=0, ob, bc, dy, br, f, x, y;
 onload=INIT;
 with(d){onmousedown=DOWN;onmousemove=MV;onmouseup=UP};
 
 function DOWN(o)
 {O(o);
  if(s==D('buddyholly')){ob=s; bc=1};
  if((st.match(/div/i)||s.nodeType==3)&&s!=D('divv')&&s!=D('bu')&&s.parentNode!=D('divv')&&s.parentNode!=D('bu')&&!st.match(/img/i))
  {ob=da?s:s.nodeType==3?s.parentNode:s; bc=0};
  if(st.match(/img/i)&&ob)machhin=1;
  if(ob){var c=bc==0?C(ob):B(ob), dy=T(D('r'));
   V(D('divv'),1);
   I(D('bu'), ob.id+'<br />'+RGB(c));
   T(D('zr'),RGB(c,0)+dy); T(D('zg'),RGB(c,1)+dy); T(D('zb'),RGB(c,2)+dy)};
  if(s==D('x'))V(D('divv'),0);
 };
 
 function MV(o)
 {O(o);
  f=y-br>255?255:y-br<0?0:y-br;
  if(ob&&machhin==1)MH();
 };
 
 function UP(o)
 {O(o);
  if(ob)MH();
  machhin=0;
 };
 
 function A(p1,p2){return A.arguments.length==1?p1.arguments.length:p1.arguments[p2]};
 function B(b0,b1){return A(B)==1?b0.style.backgroundColor:b0.style.backgroundColor=b1};
 function C(c0,c1){return A(C)==1?c0.style.color:c0.style.color=c1};
 function D(d0){return d.getElementById(d0)};
 function F(f0,f1){return A(F)==1?PI(f0.style.fontSize):f0.style.fontSize=f1};
 function FF(f0,f1){return A(FF)==1?f0.style.fontFamily:f0.style.fontFamily=f1};
 function H(h0,h1){return A(H)==1?PI(h0.style.height):h0.style.height=h1};
 function I(i0,i1){return A(I)==1?i0.innerHTML:i0.innerHTML=i1};
 function L(l0,l1){return A(L)==1?PI(l0.style.left):l0.style.left=l1};
 function M(){for(var i=1; i<A(M)/2; i++)eval('A(M,i*2-1)'+'('+'A(M,0)'+',"'+A(M,i*2)+'")')};
 function MH()
 {var c=(MV.F=bc==0?C:B)(ob), ic=ob.id+'<br />'+RGB(c);
  s==D('r')?( MV.F(ob, RGB(f, RGB(c,1), RGB(c,2))),  T(D('zr'), f+dy)):
  s==D('g')?( MV.F(ob, RGB(RGB(c,0), f, RGB(c,2))),  T(D('zg'), f+dy)):
  s==D('b')?( MV.F(ob, RGB(RGB(c,0), RGB(c,1), f)),  T(D('zb'), f+dy)):null;
  I(D('bu'), ic)};
 function O(o)
 {s=da?event.srcElement:o.target; st=s.tagName?s.tagName:'';
  x=da?event.clientX+d.body.scrollLeft:o.pageX; y=da?event.clientY+d.body.scrollTop:o.pageY};
 function P(p0,p1){return p0.style.position=p1==0?'absolute':'relative'};
 function PI(p0){return parseInt(p0)};
 function RGB(p1,p2,p3)
 {if(A(RGB)<=2)
  {if(p1.match(/#|rgb/i))
   {function RGBX(x1,x2){return (p1.match(/#/)?(eval('0x'+p1.match(x1)[1]).toString(10)):p1.match(x2)[1])*1};
    var r=RGBX(/#(..)/,/((d+)/);
    var g=RGBX(/#..(..)/,/,(d+)/);
    var b=RGBX(/#....(..)/,/(d+))/);
    return p2==0?r:p2==1?g:p2==2?b:'rgb('+r+','+g+','+b+')';
    }
    else return p2==0?0:p2==1?0:p2==2?0:'rgb('+0+','+0+','+0+')';
  };
  if(A(RGB)==3)return 'rgb('+p1+','+p2+','+p3+')';
 };
 function T(t0,t1){return A(T)==1?PI(t0.style.top):t0.style.top=t1};
 function V(v0,v1){v0.style.visibility=v1==0?'hidden':'visible'};
 function W(w0,w1){return A(W)==1?PI(w0.style.width):w0.style.width=w1};
 </script>
 </head>
 <body id='buddyholly'>
 <div id='holla'>holla</div>
 <div id='hoppsassa'>hoppsassa</div>
 <div id='haschmisch'>haschmischichbindiewaldfee</div>
 
 <div id='divv'>
 <div id='bu'></div>
 <div id='x'></div>
 <div id='zr'></div>
 <div id='zb'></div>
 <div id='zg'></div>
 <img id='r' src='../../../images/rot_skala.gif' alt=''>
 <img id='g' src='../../../images/gruen_skala.gif' alt=''>
 <img id='b' src='../../../images/blau_skala.gif' alt=''>
 </div>
 </body>
 </html>
  

gruß

matho

28

Re: für was brauch ich einen Schieberegler?

Moinmoin,

der Vollständigkeit halber, damit's auch in moz und phoenix
geht:

 

 
 
 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
 <html>
 <head>
 <title>div_IE6_NN7_OP7_PH0.5_MZ1.2</title>
 <meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>
 <style type="text/css">
 div{position:absolute;font-Size:0px;cursor:default;};
 </style>
 <script type='text/javascript'>
 
 function INIT()
 {M(D('holla'),F,178,FF,'verdana',L,300,T,200);
  M(D('hoppsassa'),F,69,FF,'courier',L,500,T,100);
  M(D('haschmisch'),F,34,FF,'impact',L,150,T,450,C,'#aa3388');
 
  //wenn Du ab hier etwas änderst, mußt Du wissen, was Du tust
 
  B(D('buddyholly'),'#ffffff');
  M(D('divv'),T,20,W,120,H,310,V,0,B,'gray',P,1);
  M(D('x'),W,12,H,12,B,'#aa0000',T,2,L,106);
  M(D('bu'),F,13,FF,'verdana',W,120,H,33,B,'#666666');
  M(D('r'),H,258,L,15,T,40,P,0);
  M(D('g'),H,258,L,50,T,40,P,0);
  M(D('b'),H,258,L,85,T,40,P,0);
  M(D('zr'),W,7,H,2,L,8,T,40,B,'black');
  M(D('zg'),W,7,H,2,L,43,T,40,B,'black');
  M(D('zb'),W,7,H,2,L,78,T,40,B,'black');
  dy=T(D('r')); br=dy+T(D('divv'))+(da&&!wo?17:8);
 };
 
 var d=document, da=d.all, wo=window.opera, machhin=0, ob, bc, dy, br, f, x, y;
 onload=INIT;
 
 d.onmousedown=function(o){O(o);
  if(s==D('buddyholly')){ob=s; bc=1};
  if((st.match(/div/i)||s.nodeType==3)&&s!=D('divv')&&s!=D('bu')&&s.parentNode!=D('divv')&&s.parentNode!=D('bu')&&!st.match(/img/i))
  {ob=da?s:s.nodeType==3?s.parentNode:s; bc=0};
  if(st.match(/img/i)&&ob)machhin=1;
  if(ob){var c=bc==0?C(ob):B(ob), dy=T(D('r'));
   V(D('divv'),1);
   I(D('bu'), ob.id+'<br />'+RGB(c));
   T(D('zr'),RGB(c,0)+dy); T(D('zg'),RGB(c,1)+dy); T(D('zb'),RGB(c,2)+dy)};
  if(s==D('x'))V(D('divv'),0);
 };
 
 d.onmousemove=function(o){O(o); if(ob&&machhin==1)MH()};
 d.onmouseup=function(o){O(o); if(ob)MH(); machhin=0};
 
 function A(p1,p2){return A.arguments.length==1?p1.arguments.length:p1.arguments[p2]};
 function B(b0,b1){return A(B)==1?b0.style.backgroundColor:b0.style.backgroundColor=b1};
 function C(c0,c1){return A(C)==1?c0.style.color:c0.style.color=c1};
 function D(d0){return d.getElementById(d0)};
 function F(f0,f1){return A(F)==1?PI(f0.style.fontSize):f0.style.fontSize=f1};
 function FF(f0,f1){return A(FF)==1?f0.style.fontFamily:f0.style.fontFamily=f1};
 function H(h0,h1){return A(H)==1?PI(h0.style.height):h0.style.height=h1};
 function I(i0,i1){return A(I)==1?i0.innerHTML:i0.innerHTML=i1};
 function L(l0,l1){return A(L)==1?PI(l0.style.left):l0.style.left=l1};
 function M(){for(var i=1; i<A(M)/2; i++)eval('A(M,i*2-1)'+'('+'A(M,0)'+',"'+A(M,i*2)+'")')};
 function MH()
 {f=y-br>255?255:y-br<0?0:y-br;
  var c=(MH.F=bc==0?C:B)(ob), c0=RGB(c,0), c1=RGB(c,1), c2=RGB(c,2), ic=ob.id+'<br />'+RGB(c);
  s==D('r')?( MH.F(ob, RGB(f , c1, c2)),  T(D('zr'), f+dy)):
  s==D('g')?( MH.F(ob, RGB(c0, f , c2)),  T(D('zg'), f+dy)):
  s==D('b')?( MH.F(ob, RGB(c0, c1, f )),  T(D('zb'), f+dy)):null;
  I(D('bu'), ic)};
 function O(o)
 {s=da?event.srcElement:o.target; st=s.tagName?s.tagName:'';
  x=da?event.clientX+d.body.scrollLeft:o.pageX; y=da?event.clientY+d.body.scrollTop:o.pageY};
 function P(p0,p1){return p0.style.position=p1==0?'absolute':'relative'};
 function PI(p0){return parseInt(p0)};
 function RGB(p1,p2,p3)
 {if(A(RGB)<=2)
  {if(p1.match(/#|rgb/i))
    {function RGBX(x1,x2)
    {return (p1.match(/#/)?(eval('0x'+(p1.match(x1)[1])).toString(10)):p1.match(x2)[1])*1};
     var r=RGBX(/#(..)/,     /(s*(d+)/);
     var g=RGBX(/#..(..)/,   /,s*(d+)/);
     var b=RGBX(/#....(..)/, /(d+)s*)/);
     return p2==0?r:p2==1?g:p2==2?b:'rgb('+r+','+g+','+b+')'}
   else return p2==0?0:p2==1?0:p2==2?0:'rgb('+0+','+0+','+0+')';
  };
  if(A(RGB)==3)return 'rgb('+p1+','+p2+','+p3+')';
 };
 function T(t0,t1){return A(T)==1?PI(t0.style.top):t0.style.top=t1};
 function V(v0,v1){v0.style.visibility=v1==0?'hidden':'visible'};
 function W(w0,w1){return A(W)==1?PI(w0.style.width):w0.style.width=w1};
 </script>
 </head>
 <body id='buddyholly'>
 <div id='holla'>holla</div>
 <div id='hoppsassa'>hoppsassa</div>
 <div id='haschmisch'>haschmischischbindiewaldfee</div>
 
 <div id='divv'>
 <div id='bu'></div>
 <div id='x'></div>
 <div id='zr'></div>
 <div id='zb'></div>
 <div id='zg'></div>
 <img id='r' src='../../../images/rot_skala.gif' alt=''>
 <img id='g' src='../../../images/gruen_skala.gif' alt=''>
 <img id='b' src='../../../images/blau_skala.gif' alt=''>
 </div>
 </body>
 </html>
 
 Neckischerweise notieren moz und phoenix als Rückgabewert für rgb-Werte nämlich
 
 rgb(bla, bla, bla)
 
 statt (wie NN7)
 
 rgb(bla,bla,bla)
 
 Diesen Unterschied entdeckt man, wenn man - wie ich -
 mit den Hühnern aufsteht....
 
 gruß
 
 matho