Just nu i M3-nätverket
Gå till innehåll

MYSQL


MilleMiglia

Rekommendera Poster

Hej!

 

Jag är helt ny på detta, jag trasslar med min hemsida för skivor, nu är det så att jag vill ha in en länk i ett iframefönster

 

dvs, du klickar på en länk i ett pagersystem då ska man se skivan i ett närliggande iframfönster

 

problemet är att jag får upp bilden på skivan i ett helt nytt fönster :OOOOOO

 

 

Hur gör jag för att få ned den till iframe fönstret??

 

Tråden flyttad från MySQL av moderator

 

 

 

[inlägget ändrat 2008-10-30 18:18:05 av Cluster]

Länk till kommentar
Dela på andra webbplatser

Hm, rubriken är "MYSQL" och tråden ligger i MySql-forum, men frågan handlar om något helt annat?

 

Hursomhelst, skriv om länken på följande sätt:

<a href="#" onclick="document.getElementById('MyIframe').src='http://www.sr.se';">Test</a>
<iframe id="MyIframe" src="http://www.idg.se"></iframe>

 

Länk till kommentar
Dela på andra webbplatser

Hej!

 

Jag har testat detta och nu ligger det ju ett idg fönster i min iframe, lika så när jag klickar på länken kommer jag fram till SR.

 

Detta är inte riktigt vad jag menade, så jag skickar dig en länk

 

http://www.suicideshop.se/temp/

 

om du eller någon annan som är duktig klikca på första länlken dvs magical mystery tour ser du/ni hur jag tänker, den bilden ska komma upp i iframe/idg fönstret :)

 

Men tusen tack så här långt!

 

 

 

 

 

 

Länk till kommentar
Dela på andra webbplatser

Hej @dy

 

 

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Namnl&ouml;st dokument</title>
<style type="text/css">
<!--
.stil2 {font-family: aaaiight!}
-->
</style>
</head>

<body>
<div align="center">
 <table width="759" border="0">
   <tr>
     <td width="107">&nbsp;</td>
     <td width="454"><div align="center"><img src="logo.jpg" width="454" height="152" /></div></td>
     <td width="107">&nbsp;</td>
   </tr>
   <tr>
     <td><div align="center"></div></td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
   <tr>
     <td height="319"><div align="center">
						<table width="117" border="0">
                             <tr>
                               <th height="47" scope="col"><span class="stil2"><a href="#"><img src="about.jpg" width="100" height="56" hspace="1" vspace="2" align="top" /></a></span></th>
                             </tr>
                             <tr>
                               <th height="47" scope="col"><span class="stil2"><a href="#"><img src="home.jpg" width="100" height="56" hspace="1" vspace="2" align="top" /></a></span></th>
                             </tr>
                             <tr>
                               <th height="47" scope="col"><span class="stil2"><a href="#"><img src="faq.jpg" width="100" height="56" hspace="1" vspace="2" align="top" /></a></span></th>
                             </tr>
                           </table>
						<p class="stil2">&nbsp;</p>
						<p class="stil2">&nbsp;</p>
       <p class="stil2">&nbsp;</p>
     </div></td>
     <td><?$start = $_GET["start"];

require "config.php";           // All database details will be included here 



$page_name="index.php"; //  If you use this code with a different page ( or file ) name then change this 



if(!isset($start)) {                         // This variable is set to zero for the first page

$start = 0;

}



$eu = ($start - 0); 

$limit = 5;                                 // No of records to be shown per page.

$this1 = $eu + $limit; 

$back = $eu - $limit; 

$next = $eu + $limit; 





/////////////// WE have to find out the number of records in our table. We will use this to break the pages///////

$query2=" SELECT * FROM articles_";

$result2=mysql_query($query2);

echo mysql_error();

$nume=mysql_num_rows($result2);

/////// The variable nume above will store the total number of records in the table////



/////////// Now let us print the table headers ////////////////

$bgcolor="#f1f1f1";

echo "<TABLE width='420px' position: absolute; align=center  cellpadding=0 cellspacing=0> <tr>";

echo "<td  bgcolor='dfdfdf' >&nbsp;<font face='Trebuchet MS' color='#000000' size='3'><b>Artist</b></font></td>";

echo "<td  bgcolor='dfdfdf' >&nbsp;<font face='Trebuchet MS' color='#000000' size='3'><b>Record</b></font></td>";

echo "<td  bgcolor='dfdfdf' >&nbsp;<font face='Trebuchet MS' color='#000000' size='3'><b>Label</b></font></td>";

echo "<td  bgcolor='dfdfdf' >&nbsp;<font face='Trebuchet MS' color='#000000' size='3'><b>Format</b></font></td>";

echo "<td  bgcolor='dfdfdf' >&nbsp;<font face='Trebuchet MS' color='#000000' size='3'><b>Year</b></font></td>";

echo "<td  bgcolor='dfdfdf' >&nbsp;<font face='Trebuchet MS' color='#000000' size='3'><b>Notes</b></font></td>";



////////////// Now let us start executing the query with variables $eu and $limit  set at the top of the page///////////

$query=" SELECT * FROM articles_  limit $eu, $limit ";

$result=mysql_query($query);

echo mysql_error();



//////////////// Now we will display the returned records in side the rows of the table/////////

while($noticia = mysql_fetch_array($result))

{

if($bgcolor=='#f1f1f1'){$bgcolor='#ffffff';}

else{$bgcolor='#f1f1f1';}



echo "<tr >";

echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Trebuchet MS' size='2'>$noticia[title]</font></td>"; 

echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Trebuchet MS' size='2'><a href='$noticia[url]'>$noticia[info]</a></font></td>"; 

echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Trebuchet MS' size='2'>$noticia[label]</font></td>";

echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Trebuchet MS' size='2'>$noticia[format]</font></td>";

echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Trebuchet MS' size='2'>$noticia[year]</font></td>"; 

echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Trebuchet MS' size='2'>$noticia[note]</font></td>";   







echo "</tr>";

}

echo "</table>";

////////////////////////////// End of displaying the table with records ////////////////////////



/////////////// Start the buttom links with Prev and next link with page numbers /////////////////

echo "<table align = 'center' width='50%'><tr><td  align='left' width='30%'>";

//// if our variable $back is equal to 0 or more then only we will display the link to move back ////////

if($back >=0) { 

print "<a href='$page_name?start=$back'><font face='Trebuchet MS' size='2'>Prev</font></a>"; 

} 

//////////////// Let us display the page links at  center. We will not display the current page as a link ///////////

echo "</td><td align=center width='30%'>";

$i=0;

$l=1;

for($i=0;$i < $nume;$i=$i+$limit){

if($i <> $eu){

echo " <a href='$page_name?start=$i'><font face='Trebuchet MS' size='2'>$l</font></a> ";

}

else { echo "<font face='Trebuchet MS' size='2' color=red>$l</font>";}        /// Current page is not displayed as link and given font color red

$l=$l+1;

}





echo "</td><td  align='right' width='30%'>";

///////////// If we are not in the last page then Next link will be displayed. Here we check that /////

if($this1 < $nume) { 

print "<a href='$page_name?start=$next'><font face='Trebuchet MS' size='2'>Next</font></a>";} 

echo "</td></tr></table>";?></td>
				<td>
<iframe id="MyIframe" height="292" width="196"></iframe>
										</td></tr>
		</table>
	</div>
	<p>		</p>
&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
 </table>
</div>
</body>
</html>

 

Kan du mera i detalj beskriva vart jag ska pilla in target?

 

Jag har ju nu döpt framen till MyIframe tack vare Anjuna Moon :thumbsup:

 

Sen vet jag inte riktigt.

 

Jag är ledsen men jag är rikitigt dålig på detta :(

 

Tack som F*N så här långt :thumbsup::thumbsup:

 

[bild bifogad 2008-10-29 11:04:00 av xSuexEllenx]

1093933_thumb.jpg

Länk till kommentar
Dela på andra webbplatser

Ja det första är att ändra i <iframe ... taggen på rad 219 till:

 <iframe Name="MyIframe" id="MyIframe" height="292" width="196" frameborder="0" ></iframe>

 

Sedan i alla hänvisningar (läs rad 144), typ <a taggar läggs följande till efter "<a " så det står:

<a target='MyIframe' ...

' i stället fär " eftersom det i PHP kod...

 

( raderna hänvisas när jag öppnat det i separat texteditor)

Koden är inte testad men borde funka

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
;
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Namnl&ouml;st dokument</title>
<style type="text/css">
<!--
.stil2 {font-family: aaaiight!}
-->
</style>
</head>

<body>
<div align="center">
 <table width="759" border="0">
   <tr>
     <td width="107">&nbsp;</td>
     <td width="454"><div align="center"><img src="logo.jpg" width="454" height="152" /></div></td>
     <td width="107">&nbsp;</td>
   </tr>
   <tr>
     <td><div align="center"></div></td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
   <tr>
     <td height="319"><div align="center">
						<table width="117" border="0">
                             <tr>
                               <th height="47" scope="col"><span class="stil2"><a href="#"><img src="about.jpg" width="100" height="56" hspace="1" vspace="2" align="top" /></a></span></th>
                             </tr>
                             <tr>
                               <th height="47" scope="col"><span class="stil2"><a href="#"><img src="home.jpg" width="100" height="56" hspace="1" vspace="2" align="top" /></a></span></th>
                             </tr>
                             <tr>
                               <th height="47" scope="col"><span class="stil2"><a href="#"><img src="faq.jpg" width="100" height="56" hspace="1" vspace="2" align="top" /></a></span></th>
                             </tr>
                           </table>
						<p class="stil2">&nbsp;</p>
						<p class="stil2">&nbsp;</p>
       <p class="stil2">&nbsp;</p>
     </div></td>
     <td><?$start = $_GET["start"];

require "config.php";           // All database details will be included here 



$page_name="index.php"; //  If you use this code with a different page ( or file ) name then change this 



if(!isset($start)) {                         // This variable is set to zero for the first page

$start = 0;

}



$eu = ($start - 0); 

$limit = 5;                                 // No of records to be shown per page.

$this1 = $eu + $limit; 

$back = $eu - $limit; 

$next = $eu + $limit; 





/////////////// WE have to find out the number of records in our table. We will use this to break the pages///////

$query2=" SELECT * FROM articles_";

$result2=mysql_query($query2);

echo mysql_error();

$nume=mysql_num_rows($result2);

/////// The variable nume above will store the total number of records in the table////



/////////// Now let us print the table headers ////////////////

$bgcolor="#f1f1f1";

echo "<TABLE width='420px' position: absolute; align=center  cellpadding=0 cellspacing=0> <tr>";

echo "<td  bgcolor='dfdfdf' >&nbsp;<font face='Trebuchet MS' color='#000000' size='3'><b>Artist</b></font></td>
;";

echo "<td  bgcolor='dfdfdf' >&nbsp;<font face='Trebuchet MS' color='#000000' size='3'><b>Record</b></font></td>
;";

echo "<td  bgcolor='dfdfdf' >&nbsp;<font face='Trebuchet MS' color='#000000' size='3'><b>Label</b></font></td>
";

echo "<td  bgcolor='dfdfdf' >&nbsp;<font face='Trebuchet MS' color='#000000' size='3'><b>Format</b></font></td>
;";

echo "<td  bgcolor='dfdfdf' >&nbsp;<font face='Trebuchet MS' color='#000000' size='3'><b>Year</b></font></td>"
;

echo "<td  bgcolor='dfdfdf' >&nbsp;<font face='Trebuchet MS' color='#000000' size='3'><b>Notes</b></font></td>
";



////////////// Now let us start executing the query with variables $eu and $limit  set at the top of the page///////////

$query=" SELECT * FROM articles_  limit $eu, $limit ";

$result=mysql_query($query);

echo mysql_error();



//////////////// Now we will display the returned records in side the rows of the table/////////

while($noticia = mysql_fetch_array($result))

{

if($bgcolor=='#f1f1f1'){$bgcolor='#ffffff';}

else{$bgcolor='#f1f1f1';}



echo "<tr >";


echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Trebuchet MS' size='2'>$noticia[title]</font></td>"; 

echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Trebuchet MS' size='2'><a target='MyIframe' href='$noticia[url]'>$noticia[info]</a></font>
;</td>"; 

echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Trebuchet MS' size='2'>$noticia[label]</font></td>";

echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Trebuchet MS' size='2'>$noticia[format]</font></td>";

echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Trebuchet MS' size='2'>$noticia[year]</font></td>"; 

echo "<td align=left bgcolor=$bgcolor id='title'>&nbsp;<font face='Trebuchet MS' size='2'>$noticia[note]</font></td>";   







echo "</tr>";

}

echo "</table>";

////////////////////////////// End of displaying the table with records ////////////////////////



/////////////// Start the buttom links with Prev and next link with page numbers /////////////////

echo "<table align = 'center' width='50%'><tr><td  align='left' width='30%'>";

//// if our variable $back is equal to 0 or more then only we will display the link to move back ////////

if($back >=0) { 

print "<a href='$page_name?start=$back'><font face='Trebuchet MS' size='2'>Prev</font></a>"; 

} 

//////////////// Let us display the page links at  center. We will not display the current page as a link ///////////

echo "</td><td align=center width='30%'>";

$i=0;

$l=1;

for($i=0;$i < $nume;$i=$i+$limit){

if($i <> $eu){

echo " <a href='$page_name?start=$i'><font face='Trebuchet MS' size='2'>$l</font></a> ";

}

else { echo "<font face='Trebuchet MS' size='2' color=red>$l</font>";}        /// Current page is not displayed as link and given font color red

$l=$l+1;

}





echo "</td><td  align='right' width='30%'>";

///////////// If we are not in the last page then Next link will be displayed. Here we check that /////

if($this1 < $nume) { 

print "<a href='$page_name?start=$next'><font face='Trebuchet MS' size='2'>Next</font></a>";} 

echo "</td></tr></table>";?></td>
				<td>
<iframe Name="MyIframe" id="MyIframe" height="292" width="196" frameborder="0" ></iframe>
										</td></tr>
		</table>
	</div>
	<p>		</p>
&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
 </table>
</div>
</body>
</html>

 

Länk till kommentar
Dela på andra webbplatser

DU ÄR GUD!

 

:thumbsup::thumbsup::thumbsup::thumbsup::thumbsup::thumbsup:

:thumbsup::thumbsup::thumbsup::thumbsup::thumbsup::thumbsup:

:thumbsup::thumbsup::thumbsup::thumbsup::thumbsup::thumbsup:

:thumbsup::thumbsup::thumbsup::thumbsup::thumbsup::thumbsup:

:thumbsup::thumbsup::thumbsup::thumbsup::thumbsup::thumbsup:

:thumbsup::thumbsup::thumbsup::thumbsup::thumbsup:

 

Radbrytningar inlagda av moderator

 

[inlägget ändrat 2008-10-30 18:19:08 av Cluster]

Länk till kommentar
Dela på andra webbplatser

Jag har testat detta och nu ligger det ju ett idg fönsterkution i min iframe, lika så när jag klickar på länken kommer jag fram till SR

Jösses, snälla säg att du inte är så blond och dum att du inte klarade av att ens ersätta detta i mitt exempel.

 

[inlägget ändrat 2008-10-30 00:42:02 av Anjuna Moon]

Länk till kommentar
Dela på andra webbplatser

Arkiverat

Det här ämnet är nu arkiverat och är stängt för ytterligare svar.

×
×
  • Skapa nytt...