JavaScript And PHP


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>";


echo "</script>";

echo "<noscript>";


echo "</noscript>";

Thanks for any help,


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.

echo “document.writeln(”

echo “document.writeln(”");\n";

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.


Sponsor our Newsletter | Privacy Policy | Terms of Service