SimplePortal

Support => International Support => Spanish => Topic started by: angelverde on August 03, 2010, 06:24:31 AM

Title: Javascript no funciona en Pagina
Post by: angelverde on August 03, 2010, 06:24:31 AM
Esta en uso SMF 1.1.11 con Simple Portal 2.3.2, el link del sitio es este (http://www.forosbuap.mx)

Me tomo horas para que un JavaScript me funcionara, lo estuve probando en esta pagina (http://www.w3schools.com/TAGS/tryit.asp?filename=tryhtml_iframe) para probar modificaciones, cuando todo estuvo correcto fui al panel de Simple Portal y cree una nueva página tipo HTML, el problema esta en que el JS no funciona en ella.

Probe meter el JS antes de </head> y tampoco funciona, el link de la pagina creada es este (http://www.forosbuap.mx/index.php?page=chat) si prueban los botones no verán algún cambio, cuando deberian cambiar los iframes.

El código de la página es este:
Code: [Select]
<a href="http://www.forosbuap.mx/chat/index.php" target="popup" onclick="window.open(this.href, 'chat', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=760px,height=550px');this.blur();return false;"><b>Ver el Chat en Ventana nueva</b></a>
<br />
<p>
<b>Disfruta de nuestra Programación</b>
<div class="smalltext">Prueba las estaciones de Grupo Acir, de Radio BUAP o películas en Streaming.<br /> Solo diviertete, aunque también puedes cerrar todo, da clic en el botón que más te guste:</div>

<script language="JavaScript" type="text/javascript">
<!--
function crearFrame(val, anc, alt) {
    var testFrame = document.createElement("IFRAME");
    testFrame.id = "contenidos";
    testFrame.src = val;
    testFrame.width = anc;
    testFrame.height = alt;
    testFrame.frameborder = "0";
    testFrame.scrolling = "no";
    var control = document.getElementById(testFrame.id)
    document.body.removeChild(control);
    document.body.appendChild(testFrame);

//-->
</script>
<form>
<input type="button" value="Silencio" onclick="crearFrame('nada.html', '1', '1')"/>
<input type="button" value="Grupo Acir" onclick="crearFrame('http://www.grupoacir.com.mx/multimedia/audio/radio/flash/mixquer.php', '500', '400')"/>
<input type="button" value="Radio BUAP" onclick="crearFrame('http://www.enciendetv.buap.mx/paginas/2510.asp?canal=1', '550', '400')"/>
</form>
</p>
<br />
<iframe  id="contenidos"
   frameborder="0"
   width="500"
   scrolling="no"
   height="400"
   src="http://www.grupoacir.com.mx/multimedia/audio/radio/flash/mixquer.php">
</iframe>

Cualquier sugerencia es bienvenida.
Title: Re: Javascript no funciona en Pagina
Post by: angelverde on August 03, 2010, 06:48:21 AM
 :( :'(
Creo que mi JavaScript no funciona dentro de un <div> y por ahora ya estoy agotado para investigar, ojala me pudieran orientar un poco  :|
Title: Re: Javascript no funciona en Pagina
Post by: 130860 on August 03, 2010, 11:11:46 AM
tu codigo está mal, revisalo, asegurate e que llame a el iframe correcto o en su caso que apunte a el frame correspondiente.
Title: Re: Javascript no funciona en Pagina
Post by: angelverde on August 03, 2010, 03:04:12 PM
Revise que llame al iframe correcto y lo hace, solo que soy nuevo en JS y no se porque no funciona cuando esta dentro de un div.

Me pondre a estudiar/investigar si sabes algo por favor no dudes en comentarlo.
Title: Re: Javascript no funciona en Pagina
Post by: angelverde on August 03, 2010, 05:35:11 PM
Lo solucione metiendo el iframe en un div y luego usando este JS

Code: [Select]
<script language="JavaScript" type="text/javascript">
<!--
function crearFrame(url, anch, alt) {

  document.getElementById ("miDiv").innerHTML = "<iframe frameborder=0 scrolling=no width=" + anch + " height=" + alt + " src=" + url + "></iframe>";
  }
//-->
</script>

Vaya solucion que encontre :P
SimplePortal 2.3.8 © 2008-2024, SimplePortal