Jump to content

setVisibile with php


swamp

Recommended Posts

Hi there, I've got this code splitting the $post into divs containing 900 characters each...

 

<?
$i=-1;
for($t=0; $t<strlen($post);$t++){
if($t%904==0) $i++;
$out[$i].=$post{$t};
}
?>

<?
foreach($out as $k=>$v) $out[$k]='<div id="content_'.$k.'">'.$v."</div>";
$out=implode('',$out);

echo nl2br($out);
?>

 

I'm using java to flick through the divs, showing only one at a time, like pages (without changing the whole file)

 

<p><span class="arrow-back"><a href="#" onclick="setVisible('content_0>');">previous page</a></span>
<span class="arrow"><a href="#" onclick="setVisible('content_1>');">next page</a></span></p>

 

I need the arrows that setVisibile('content_NUMBER') to work out which div you're currently in and then give you next and back so in div 3 you could go back to div 2 or forward to div 4...

 

Any help? Thx!

Link to comment
https://forums.phpfreaks.com/topic/120673-setvisibile-with-php/
Share on other sites

well you'll need to set a javascript variable up so the script knows which page you're on and then make that div invisible and make the next / previous one visible...

 

Just add that to your function and it should work fine.

 

Try putting the post in the javascript forum rather than the PHP one - might be why you've not got a reply until now.

Link to comment
https://forums.phpfreaks.com/topic/120673-setvisibile-with-php/#findComment-622863
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.