JavaScript And PHP

Hi,

I’ve been searching around the net for awhile to try to figure out a solution for a problem but still can’t get it. I’m trying to make a table where each row is a clickable link. This works fine as long as JavaScript is enabled, however not so much if javascript is disabled! Is it possible to output code, in PHP, so that if JavaScript is enabled one a table with an entire clickable row is produced and if JavaScript is disabled a table with standard ‘’ tag links in each row.

In my head i have it something like:

echo "<script>";

createRowClickableTable()

echo "</script>";

echo "<noscript>";

createStandardTable();

echo "</noscript>";

Thanks for any help,

Mike

Figured it out. I used the system I mentioned in the ‘code box’ above and adjusted the function so that when php was echoing it would echo javascript.

[php]
echo “document.writeln(”

");\n";
echo “document.writeln(”");\n";
[/php]

It’s probably considered a hack to get it working but best I could come up with. Would be better and more efficient if I could determine if Javascript was enabled then activate one function or the other, rather than having to run both functions.

If anyone has suggestions it appreciated.

Mike

Sponsor our Newsletter | Privacy Policy | Terms of Service