On 9/8/06, Chetan Pandey <[EMAIL PROTECTED]> wrote:
I wasn't looking at the Source cos I am working through Eclipse and I don't think there is a way to lookup Source in Eclipse. So I manually generated WAR and tested in on IE. And surprising results!!!! For usage of onclick = '<%="return confirmationMessage(" + jsMessage + ")" %>' I saw onclick="return confirmationMessage(Are you sure want to delete this Course?)"> This was hilarious. And this is my Javascript: <script type="text/javascript"> function confirmationMessage(message) { var agree = confirm(message); if (agree) return true ; else return false ; } </script> But when I click on "delete" no Javascript pops-up and the Server straight away deletes without a warning.
Ok so JSP variable is being read. Now try this onclick = '<%="return confirmationMessage(" + "\'" + jsMessage + "\'" + ")" %>' I know the above thing is confusing, its basically single quotes around your jsMessage variable.so that a string gets passed to your javascript. your output should be onclick="return confirmationMessage('Are you sure you want to delete this?')" -- Puneet