Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Side

[Resolvido] Inserindo javascript no php....!

Recommended Posts

Galera estou precisando inserir um popup no meu código php

mas naum sei oq estou fazendo de errado, entaum vou postar

aki pra ver se alguém me dá uma luz ae ....

 

agradeço desde jah...vlws

 

echo "
			<tr>
				<td width=128><img src=admin/$linha[foto] name=PictureBox width=120 height=90 border=1></td>
				<td>
					<table>
						<tr height=30><td style=\"background-image: url('plane_new.jpg'); background-repeat: no-repeat\" width=280> $linha[nome_noticia]</td></tr>
						<tr><td>$linha[resumo_noticia]</td></tr>
						<tr><td><a href='#' onClick='AbreJanela('teste.php','','width=300,height=300')'>Detalhes</a></td></tr>
					</table>
				</td>
			</tr>"

Compartilhar este post


Link para o post
Compartilhar em outros sites

E qual o erro?

a função: AbreJanela() existe?

 

Analise o HTML gerado, para saber oq está acontecendo...

Compartilhar este post


Link para o post
Compartilhar em outros sites

Por favor, melhore sua dúvida, seja claro ao postar uma dúvida, dê sempre os detalhes.

 

 

O que ocorre ? a janela não abre ? ou o que ?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Ok... e essa função: AbreJanela() existe? Mostra ela..

Como tá o HTML gerado.. o Browser indica possíveis erros no canto inferior esquerdo de Javascript...

 

tá mostrando algo nesse console? Existe um plugin muito bom do FF chamado: FireBug...

tem como colocar um link do site no ar?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Dae William beleza?

cara naum tem esta função, acho q ae começa meu erro....

vou postar o código inteiro...se poder me ajudar agradeço veio...vlws

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>::: Central Park - Sua Agência de Viagens desde 1988 :::</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<style type="text/css">
td img {display: block;}body {
  margin-left: 0px;
  margin-top: 0px;
  margin-right: 0px;
  margin-bottom: 0px;
}
.style1 {
  font-family: Verdana, Arial, Helvetica, sans-serif;
  font-size: 10px;
  color: #999999;
}
</style>
<!--Fireworks 8 Dreamweaver 8 target.  Created Fri Oct 03 10:57:21 GMT-0300 (Hora oficial do Brasil) 2008-->
</head>
<body bgcolor="#ffffff">
<br />
<table width="662" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
	<th width="658" scope="col"><table width="655" border="0" cellpadding="0" cellspacing="0">
	  <tr>
		<th width="205" height="166" align="center" valign="top" scope="col"><a href="index.php"><img src="logo.jpg" width="192" height="153" border="0" /></a></th>
		<th width="4" align="left" valign="top" scope="col"> </th>
		<th width="446" align="left" valign="top" scope="col"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="446" height="166">
			<param name="movie" value="topo2.swf" />
			<param name="quality" value="high" />
			<embed src="topo2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="446" height="166"></embed>
		</object></th>
	  </tr>
	  <tr>
		<td colspan="2"></td>
	  </tr>
	  <tr>
		<td colspan="3" align="center"><img src="sua_agencia.jpg" width="605" height="19" /></td>
	  </tr>
	  <tr>
		<td colspan="3" align="center" valign="top"><img src="menu.jpg" width="650" height="25" border="0" usemap="#Map" /></td>
	  </tr>
	  <tr>
		<td colspan="3" align="right"><img src="admin.jpg" width="70" height="15" border="0" usemap="#Map2" /></td>
	  </tr>
	  <tr>
		<td colspan="3" align="left" valign="top"><table width="645" border="0" cellspacing="0" cellpadding="0">
			<tr>
			  <th width="486" height="614" scope="col"><table width="413" border="0" align="left" cellpadding="0" cellspacing="0">
				  <tr>
					<th width="31" scope="col"></th>
					<th width="382" align="right" scope="col"><div align="right"><img src="destaque.jpg" width="382" height="25" /></div></th>
				  </tr>
				  <tr>
					<td align="right" valign="top"><img src="pacotes_inter.jpg" width="27" height="283" /></td>
					<td align="left" valign="top"><table width="447" height="282" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
						<tr>
						  <th height="280" scope="col"><table width="100%" height="100%">
<?
  include "admin/conn.php";

  $noticias = mysql_query('
	Select
	  ntc.nome_noticia,
	  ntc.resumo_noticia,
	  fnt.foto
	From
	  noticias ntc
	Join
	  foto_noticias fnt on fnt.codigo_noticia = ntc.codigo_noticia
	Where
	  ntc.ativado = 1
	and
	  ntc.tipo like "internacional"
	order by
	  rand()
	limit
	  3');
  
  while ($linha = mysql_fetch_array($noticias))
		echo "
			<tr>
				<td width=128><img src=admin/$linha[foto] name=PictureBox width=120 height=90 border=1></td>
				<td>
					<table>
						<tr height=30><td style=\"background-image: url('plane_new.jpg'); background-repeat: no-repeat\" width=280> $linha[nome_noticia]</td></tr>
						<tr><td>$linha[resumo_noticia]</td></tr>
						<tr><td><a href='#' onClick='AbreJanela('teste.php','','width=300,height=300')'>Detalhes</a></td></tr>
					</table>
				</td>
			</tr>"
?>						  
						  </table>
						  </th>
						</tr>
					</table></td>
				  </tr>
				</table>
				  <br />
				  <br />
				  <br />
				  <br />
				  <br />
				  <br />
				  <br />
				  <br />
				  <br />
				  <br />
				  <br />
				  <br />
				  <br />
				  <br />
				  <br />
				  <br />
				  <br />
				  <table width="413" border="0" align="left" cellpadding="0" cellspacing="0">

					<tr>
					  <td width="413" align="right" valign="top"><table width="413" border="0" align="left" cellpadding="0" cellspacing="0">

						<tr>
						  <td width="31" align="right" valign="top"><img src="pacotes_nac.jpg" width="27" height="283" /></td>
						  <td width="382" align="left" valign="top"><table width="447" height="282" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
							  <tr>
								<th height="280" scope="col">
								  <table width="100%" height="100%">
<?
  $noticias = mysql_query('
	Select
	  ntc.nome_noticia,
	  ntc.resumo_noticia,
	  fnt.foto
	From
	  noticias ntc
	Join
	  foto_noticias fnt on fnt.codigo_noticia = ntc.codigo_noticia
	Where
	  ntc.ativado = 1
	and
	  ntc.tipo like "nacional"
	order by
	  rand()
	limit
	  3');
		
  while ($linha = mysql_fetch_array($noticias))
	echo "
			<tr>
				<td width=128><img src=admin/$linha[foto] name=PictureBox width=120 height=90 border=1></td>
				<td>
					<table>
						<tr height=30><td style=\"background-image: url('plane_new.jpg'); background-repeat: no-repeat\" width=280> $linha[nome_noticia]</td></tr>
						<tr><td>$linha[resumo_noticia]</td></tr>
						<tr><td><a href=\"\">Detalhes</a></td></tr>
					</table>
				</td>
			</tr>"
?>						  
								  </table>								
								</th>
							  </tr>
						  </table></td>
						</tr>
					  </table></td>
					</tr>
				</table></th>
			  <td width="159" align="center" valign="top" scope="col"><table width="150" height="478" border="0" cellpadding="0" cellspacing="0">
				  <tr>
					<th height="19" align="center" scope="col"><table width="160" border="0" cellspacing="0" cellpadding="0">
						<tr>
						  <th align="center" scope="col"><img src="destaque_cru.jpg" width="160" height="25" /></th>
						</tr>
					</table></th>
				  </tr>
				  <tr>
					<td height="453" align="center" valign="top"><table width="180" height="452" border="0" cellpadding="0" cellspacing="0">
						<tr>
						  <th width="10" height="452" scope="col"> </th>
						  <th width="170" align="left" valign="top" scope="col"><table width="160" height="452" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
							  <tr>
								<th height="450" align="center" scope="col"><table width="176" height="431" border="0" cellpadding="0" cellspacing="0">
									<tr>
									  <th width="176" height="121" align="center" scope="col"><p><img src="cru_01.jpg" width="168" height="121" /></p>										</th>
									</tr>
									<tr>
									  <td height="103" align="center"><p class="style1">O Melhor navio que já passou pela costa brasileira, um magnífico transatlântico com roteiros variados. Sem mencionar o luxo em seu interior.</p>										</td>
									</tr>
									<tr>
									  <td height="121" align="center"><img src="cru_02.jpg" width="168" height="121" /></td>
									</tr>
									<tr>
									  <td height="86" align="center"><p class="style1"><br />
										Pacotes especiais de<br />
										  até 15 dias navegando<br />
										sobre vários lugares.</p>
										<p class="style1"> </p></td>
									</tr>
								</table>
								  <br />
								  <table width="160" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
									<tr>
									  <td align="center"><img src="visa.jpg" width="118" height="68" /></td>
									</tr>
								  </table>
								  <table width="160" border="0" align="center" cellpadding="0" cellspacing="0">
									<tr>
									  <td><span class="style1"><img src="formas_pag.jpg" width="160" height="25" align="absmiddle" /></span></td>
									</tr>
								  </table></th>
							  </tr>
						  </table></th>
						</tr>
					</table></td>
				  </tr>
			  </table>
				<br />
				<br /></td>
			</tr>
		</table></td>
	  </tr>
	  <tr>
		<td colspan="3" align="right"><img src="head.jpg" width="30" height="30" /></td>
	  </tr>
	</table></th>
  </tr>
</table>
<map name="Map" id="Map"><area shape="rect" coords="8,2,71,23" href="empresa.php" target="_parent" />
<area shape="rect" coords="107,3,170,23" href="pacotes.php" target="_parent" />
<area shape="rect" coords="209,2,339,24" href="cursos.php" target="_parent" />
<area shape="rect" coords="378,2,446,23" href="cruzeiros.php" target="_parent" />
<area shape="rect" coords="486,3,548,23" href="galerias.php" target="_parent" />
<area shape="rect" coords="578,3,642,23" href="contato.php" target="_parent" />
</map>
<map name="Map2" id="Map2"><area shape="rect" coords="1,1,69,15" href="admin.php" target="_parent" />
</map></body>
</html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

amigo, troque sua chamada javascript por essa daqui

 

<a href=\"java script:void(0);\" onclick=\"NewWindow('teste.php','name','300','300','yes');return false;\" >Detalhes</a>

 

depois dentro do <head></head> poe

 

 

<script LANGUAGE="JavaScript">

function NewWindow(mypage, myname, w, h, scroll) {

var winl = (screen.width - w) / 2;

var wint = (screen.height - h) / 2;

winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+''

win = window.open(mypage, myname, winprops)

if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }

}

</SCRIPT>

 

vlww..espero ter ajudado!

Compartilhar este post


Link para o post
Compartilhar em outros sites

bom que resolveu.

 

 

o problema ali era apenas a aspa simples

 

para esse caso em específico, no evento onclick deve colocar aspa dupla para chamar o "javascript inline"

 

como está

onClick='AbreJanela('teste.php','','width=300,height=300')'>Detalhes

 

sugestão

 

 

onClick="AbreJanela('teste.php','espeficiqueUmNomePraJanela','width=300,height=300')">Detalhes

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.