Ayuda con la adición de una función para algunos javascript

  • b_zilla
  • Newbie
  • Newbie
  • No Avatar
  • Registrado: Oct 20, 2008
  • Mensajes: 12
  • Loc: Seattle, WA
  • Status: Offline

Nota Abril 18th, 2011, 7:06 pm

Este script rotar a través de una serie de colores en bg vuelco del vehículo.

Lo que espero hacer es llamar a más de un conjunto de colores, es decir, las paletas de color por separado...Ya sea por la utilización de un identificador diferente o llamar a una función con un nombre diferente.

Cualquier ayuda sería enormemente apreciada.

PS. por favor reemplace (DOT) y un "." en tres lugares al final de la secuencia de comandos...Lo sentimos, no podía entender la etiqueta adecuada

Código: [ Select ]


<html><head><title></title>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<script language=javascript>

colors = ["#cacdca", "#b2b4b2", "#969896", "#7d7f7d", "#ffff00"];



cRGB = [];



function toRGB(color){
 
var rgb = "rgb(" + parseInt(color.substring(1,3), 16) + ", " + parseInt(color.substring(3,5), 16) + ", " + parseInt(color.substring(5,7), 16) + ")";
 
return rgb;

}



for(var i=0; i<colors.length; i++){
 
cRGB[i] = toRGB(colors[i]);
}



function changeColor(target){

 

var swapper = navigator.appVersion.indexOf("MSIE")!=-1 ? toRGB(document.getElementById(target).style.backgroundColor) : document.getElementById(target).style.backgroundColor;

 

var set = false;
 
var xx;

 

for(var i=0; i<cRGB.length; i++){

   

if(swapper == cRGB[i]){

    

if(((i+1)) >= cRGB.length){
      
xx = 0;
    
}else{
      
xx = i+1;
    
}

    

document.getElementById(target).style.backgroundColor = colors[xx];

        document.getElementById(target).style.backgroundImage.show;

    
set = true;
    
i=cRGB.length;
   
}
 
}
 

set ? null : document.getElementById(target).style.backgroundColor = colors[1];

}


</SCRIPT>

<meta content="MSHTML 6.00.6000.16809" name=GENERATOR></head>
<body bgcolor="333333">
<div>
<div id=a1 onmouseover=changeColor(thisDOTid);
style="left: 120px; width: 180px; background-repeat: no-repeat; position: relative; height: 80px; background-color: none"></div>
<div id=a2 onmouseover=changeColor(thisDOTid);
style="left: 120px; width: 180px; background-repeat: no-repeat; position: relative; height: 80px; background-color: #666633"></div>
<div id=a3 onmouseover=changeColor(thisDOTid);
style="left: 120px; width: 180px; background-repeat: no-repeat; position: relative; height: 80px; background-color: #666633"></div></div>


</body>
</html>
  1. <html><head><title></title>
  2. <meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
  3. <script language=javascript>
  4. colors = ["#cacdca", "#b2b4b2", "#969896", "#7d7f7d", "#ffff00"];
  5. cRGB = [];
  6. function toRGB(color){
  7.  
  8. var rgb = "rgb(" + parseInt(color.substring(1,3), 16) + ", " + parseInt(color.substring(3,5), 16) + ", " + parseInt(color.substring(5,7), 16) + ")";
  9.  
  10. return rgb;
  11. }
  12. for(var i=0; i<colors.length; i++){
  13.  
  14. cRGB[i] = toRGB(colors[i]);
  15. }
  16. function changeColor(target){
  17.  
  18. var swapper = navigator.appVersion.indexOf("MSIE")!=-1 ? toRGB(document.getElementById(target).style.backgroundColor) : document.getElementById(target).style.backgroundColor;
  19.  
  20. var set = false;
  21.  
  22. var xx;
  23.  
  24. for(var i=0; i<cRGB.length; i++){
  25.    
  26. if(swapper == cRGB[i]){
  27.     
  28. if(((i+1)) >= cRGB.length){
  29.       
  30. xx = 0;
  31.     
  32. }else{
  33.       
  34. xx = i+1;
  35.     
  36. }
  37.     
  38. document.getElementById(target).style.backgroundColor = colors[xx];
  39.         document.getElementById(target).style.backgroundImage.show;
  40.     
  41. set = true;
  42.     
  43. i=cRGB.length;
  44.    
  45. }
  46.  
  47. }
  48.  
  49. set ? null : document.getElementById(target).style.backgroundColor = colors[1];
  50. }
  51. </SCRIPT>
  52. <meta content="MSHTML 6.00.6000.16809" name=GENERATOR></head>
  53. <body bgcolor="333333">
  54. <div>
  55. <div id=a1 onmouseover=changeColor(thisDOTid);
  56. style="left: 120px; width: 180px; background-repeat: no-repeat; position: relative; height: 80px; background-color: none"></div>
  57. <div id=a2 onmouseover=changeColor(thisDOTid);
  58. style="left: 120px; width: 180px; background-repeat: no-repeat; position: relative; height: 80px; background-color: #666633"></div>
  59. <div id=a3 onmouseover=changeColor(thisDOTid);
  60. style="left: 120px; width: 180px; background-repeat: no-repeat; position: relative; height: 80px; background-color: #666633"></div></div>
  61. </body>
  62. </html>
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Abril 18th, 2011, 7:06 pm

  • Zealous
  • Guru
  • Guru
  • Avatar de Usuario
  • Registrado: Abr 15, 2011
  • Mensajes: 1195
  • Loc: Sydney
  • Status: Offline

Nota Abril 19th, 2011, 1:14 am

que realmente necesita para reparar su bbtags lol
  • b_zilla
  • Newbie
  • Newbie
  • No Avatar
  • Registrado: Oct 20, 2008
  • Mensajes: 12
  • Loc: Seattle, WA
  • Status: Offline

Nota Abril 21st, 2011, 12:45 pm

Lo sentimos...la puerta se cerró de golpe en cualquier cosa que se asemeja a un enlace. Sería muy bueno para enviar una demo de trabajo útil de este script, pero no puedo poner el enlace para ello.
  • b_zilla
  • Newbie
  • Newbie
  • No Avatar
  • Registrado: Oct 20, 2008
  • Mensajes: 12
  • Loc: Seattle, WA
  • Status: Offline

Nota Abril 27th, 2011, 3:47 pm

Solucionado! Gracias y gratitud a rproctor83

[CODE] language=javascript> <script
colores var = & #91;
Y #91; " #FF0000 "," #0000ff "," #0F00F0 "," #999999 "," #000000 "y #93;,
Y #91; " #cacdca "," #b2b4b2 "," #969896 "," #7d7f7d "," #FFFF00 "y #93;
Y
Código: [ Select ]
<p id="urgent">animiation using css and javascript setInterval()</p>


<script>
var e = document.getElementById("urgent");
var colors = ["white","black","orange", "red", "blue", "purple"]    //colors to cycle through (array)
var nextColor = 0;                            //position in the cycle
// Invoke the following function every 500 milliseconds to animate border color
setInterval(function(){e.style.color=colors[nextColor++%colors.length];},500)//setInterval() is kind like a loop, also ++% is a interesting operator combination
</script>
  1. <p id="urgent">animiation using css and javascript setInterval()</p>
  2. <script>
  3. var e = document.getElementById("urgent");
  4. var colors = ["white","black","orange", "red", "blue", "purple"]    //colors to cycle through (array)
  5. var nextColor = 0;                            //position in the cycle
  6. // Invoke the following function every 500 milliseconds to animate border color
  7. setInterval(function(){e.style.color=colors[nextColor++%colors.length];},500)//setInterval() is kind like a loop, also ++% is a interesting operator combination
  8. </script>

Publicar Información

  • Total de mensajes en este tema: 5 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 264 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC