Jump to content
php.lv forumi

mazlet help


Puika1
 Share

Recommended Posts

sveiki,ka saja scripta uzlikt,lai uzspiezot uz bildes vins atveras ar rami ka logs

 

<?php
$url = "/img/pics/";
$monImage = "$url"."1.jpg";
$tueImage = "$url"."2.jpg";
$wedImage = "$url"."t3.jpg";
$thurImage = "$url"."4.jpg";
$friImage = "$url"."5.jpg";
$weekendImage = "$url"."6.jpg";
$d = date("D");

switch ($d)
{
case Mon:
echo "<img src=$monImage width=160 height=170>\n";
break;
case Tue:
echo "<img src=$tueImage width=160 height=170>\n";
break;
case Wed:
echo "<img src=$wedImage width=160 height=170>\n";
break;
case Thu:
echo "<img src=$thurImage width=160 height=170>\n";
break;
case Fri:
echo "<img src=$friImage width=160 height=170>\n";
break;
default:
echo "<img src=$weekendImage width=160 height=170>\n";
}
?>

 

 

Ui atvainojos par diviem topikiem,man nets nokaras!

Edited by Puika1
Link to comment
Share on other sites

laikam tā:

 

echo "<img src=$monImage width=160 height=170 target='_blank'>\n";

 

galīgi garām.

 

Target ir a taga atribūts, kas norāda, ko darīt, kad uzspiež uz saites - vērt jaunā logā, vai tajā pašā, vai kāda freimā...

Edited by briedis
Link to comment
Share on other sites

laikam pagaidam es labāk tikai uzdošu jautājumus :)

 

domāju to img ielikt a tag'ā

 

Ielikt a tagā, un piemest to target - tā gan var... Semantiski tas pat būtu labāks variants. Varētu arī veikt gadījumu, kad JS ir izslēgts.

<a href="bilde.jpg" target="_blank" onclick="window.open('bilde.jpg','_blank','width=400, height=200'); return false;"><img src="bilde.jpg" alt="Alternatīvs teksts" /></a>

 

(pie linka onclick beigās ir return false. Tas nodrošina, ka netiks atvērts href ceļš. Ja JS izslēgts, onclick nenostrādās, bet nostrādās tikai href atribūts)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...