PDA

View Full Version : Help with NOSCRIPT version



ro1960
03-21-2007, 11:53 AM
I'm trying to do a NOSCRIPT version of SwitchContent but I am having trouble with mixing JS and PHP code. Here's my PHP code:


echo "<div id=\"".$party_id."-title\" class=\"header_yellowdark
\" style=\"margin-top:4px; margin-bottom:4px\">".$h_party_name."</div>\n";

echo "<div id=\"".$party_id."\" class=\"switchgroup_parties\">\n";
include ("inc/resultparties_switchcontent.inc");
echo "\n</div>\n";
// texbox_white closing
echo "</div>\n";
}
?>

<script type="text/javascript">
var switchparty=new switchcontent("switchgroup_parties", "div") //Limit scanning of switch contents to just "div" elements
switchparty.setStatus('<img src="images/expander_down.gif" hspace="4" alt="" width="10" height="10"> ', '<img src="images/expander.gif" hspace="4" alt="" width="10" height="10"> ')
//switchparty.setColor('black', 'black')
switchparty.setPersist(false)
switchparty.collapsePrevious(true) //Only one content open at any given time
switchparty.init()
</script>


When JS is turned off, I would like the content to be hidden and have a href link to a page around $h_party_name.

Can someone help me with this?

Thank you.

mburt
03-21-2007, 12:51 PM
The only way to "hide" a div when JS is turned off, is to hide it with CSS (so that it will automatically be hidden), and use the style attribute in JavaScript to show it. So now, if JS is turned off it will be hidden via CSS.

ro1960
03-21-2007, 01:48 PM
Maybe I wasn't clear, I am not trying to hide the content, but in the contrary offer an alternative when JS is turned off. I'm just having trouble inserting the <noscript> code in my PHP code.