Hi, Am Di, den 20.07.2004 schrieb David Hassalevris um 1:25:
Asad,
I forgot that <dtml-eval> is not a standard product (I use it all the time). Also ascripts = 0 would not activate the javascript because <dtml-if 0> doesn't execute. Sorry about that.
P.S. - you can also use DTML to set hidden HTML <form> fields. Then inspect those fields for a value in a JavaScript function, eg ---------------------------------------------------------------------------- ------------------------------------- <script language="Javascript"> function doProcess() {
if (document.forms[0].some_switch.value == 'process') { <--------------------------- java alert('test!) ; return false ; }
</script>
<form ... > <input type="hidden" name="some_switch" value="="&dtml-someVar"> <----------------------------- DTML </form>
<a href="" onclick="doProcess();return false;"> <IMG SRC="//btn_left_process" alt="Process" border="0"/></a>
Better not use an empty href. There are a lot of situations where the user just disabled Javascript for some reason. And this way the site renders itself nonfunctional for no good reason. <a href="alternative_serverside_page" onclick="doOpenYourWindow(); return false;" target="newWindow">... </a> Of course the target and onclick is not for XHTML. Returning false from onXXX-Handler means the browser should not do its default action which is follow the link here. This way both with and without javascript you can use the site. Regards Tino Wildenhain