Ver Mensaje Individual
  #4 (permalink)  
Antiguo 25/10/2011, 14:29
Avatar de IsaBelM
IsaBelM
Colaborador
 
Fecha de Ingreso: junio-2008
Mensajes: 5.032
Antigüedad: 15 años, 10 meses
Puntos: 1012
Respuesta: Interfaz javascript y problema con settimeout

usa document.body.innerHTML

weather.js
Cita:
var cont = 0;
function weatherLoad(options){
function aleatorio(inferior,superior){
numPosibilidades = superior - inferior
aleat = Math.random() * numPosibilidades
aleat = Math.floor(aleat)
return parseInt(inferior) + aleat
}

var _AEMET_ID = '' ;
var _lang = 'es' ;
var _backgroundColor = '%23000' ;
var _font = 'Arial';
var _fontSize1 = '29px' ;
var _fontSize2 = '16px' ;
var _fontSize3 = '15px' ;
var _iconSize = '70px' ;
var _width = '575px';
var _height = '53px' ;
var _refresh = 60 ;
var _timeScroll = 4 ;

if(typeof options.aemet_id != "undefined")
_AEMET_ID = options.aemet_id;
if(typeof options.lang != "undefined")
_lang = options.lang;
if(typeof options.backgroundColor != "undefined")
_backgroundColor = options.backgroundColor;
if(typeof options.font != "undefined")
_font = options.font;
if(typeof options.fontSize1 != "undefined")
_fontSize1 = options.fontSize1;
if(typeof options.fontSize2 != "undefined")
_fontSize2 = options.fontSize2;
if(typeof options.fontSize3 != "undefined")
_fontSize3 = options.fontSize3;
if(typeof options.iconSize != "undefined")
_iconSize = options.iconSize;
if(typeof options.width != "undefined")
_width = options.width;
if(typeof options.height != "undefined")
_height = options.height;
if(typeof options.refresh != "undefined")
_refresh = options.refresh;
if(typeof options.timeScroll != "undefined")
_timeScroll = options.timeScroll;

var aleatorio = aleatorio(5,10);

if(cont == 0) {
document.write('<iframe id="weather_iframe" name="weather_iframe" src="http://external.netflie.es/vedadovision/weather.php?AEMET_ID=35015&amp;lang=es&amp;backgro undColor=%23000&amp;font=Arial&amp;fontSize1=29px& amp;fontSize2=16px&amp;fontSize3=15px&amp;iconSize =70px&amp;width=575px&amp;height=53px&amp;timeScro ll=4&amp;aleatorio=9" width="575px" height="53px" frameborder="0" scrolling="no"></iframe>');
}
cont = cont +1;


// Refresh page
this.intervalo = function(){
if(cont != 0) {
document.body.innerHTML = '<script type="text/javascript">var options = {aemet_id: "350152",lang: "es"}; weatherLoad(options);</script>\n\n<iframe id="weather_iframe" name="weather_iframe" src="http://external.netflie.es/vedadovision/weather.php?AEMET_ID=35015&amp;lang=es&amp;backgro undColor=%23000&amp;font=Arial&amp;fontSize1=29px& amp;fontSize2=16px&amp;fontSize3=15px&amp;iconSize =70px&amp;width=575px&amp;height=53px&amp;timeScro ll=4&amp;aleatorio=9" width="575px" height="53px" frameborder="0" scrolling="no"></iframe>';
}
}
}

var obj = new weatherLoad();
setInterval(function() {obj.intervalo()}, 30000);
archivo.html
Cita:
<script type="text/javascript" src="weather.js"></script>
<script type="text/javascript">
var options = {
aemet_id: '35015',
lang: 'es'
}
weatherLoad(options);
</script>

Última edición por IsaBelM; 27/10/2011 a las 12:45 Razón: añadir un contador