<?php
$i=1;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>
<script type="text/javascript">
function show(ele) {
var srcElement = document.getElementById(ele);
if(srcElement != null) {
if(srcElement.style.display == "block") {
srcElement.style.display= 'none';
var link_name = "<br>Читать далее<?=$i?>";
var link_names = "...";
document.getElementById("tips<?=$i?>").innerHTML = link_name;
document.getElementById("tt<?=$i?>").innerHTML = link_names;
}
else{
srcElement.style.display='block';
var link_name = 'Свернуть<?=$i?>';
var link_names = "";
document.getElementById("tips<?=$i?>").innerHTML = link_name;
document.getElementById("tt<?=$i?>").innerHTML = link_names;
}
}
}
</script>
</head>
<body>
<?php
for( $i=1; $i<6; $i++){
global $i;
?>
<p>
<span style="float: left;">kh j ljk lkj lkj lkj kj !</span><span id="tt<?=$i?>">...</span>
<div class="hidden" style="display: none;" id="cat<?=$i?>">
<span>nnwedl jnew dfejefr rfjrelfe rfelf er </span>
</div>
<div class="headline" onclick="show('cat<?=$i?>')"><p id="tips<?=$i?>" style="text-align: left;"><br>Читать далее<?=$i?></p></div>
</p>
<?php }?>
</body>
</html> |