I have the following code in the footer and it produces a button on the bottom of my results page that works to redirect the user to another url.
<script type="text/javascript">
if(!document.getElementById("norecord"))
{
document.write('<button onclick=document.location.href="https://www.myirlog.com/logbook/new-record-entry">No, Really, I want to add a new record</button>');
}
</script>
However, when I put that same code inside of an HTML block, it does not work:
<script type="text/javascript">
if('[@field:participant_1_name]' != '[@authfield:Name]' && '[@field:participant_2_name]' != '[@authfield:Name]' && '[@field:participant_3_name]' != '[@authfield:Name]' )
{
if('[@field:participant_2_name]' == '' || '[@field:participant_3_name]' == '' )
{
document.write('<button onclick=document.location.href="https://www.google.com">take me away</button>');
}
}
</script>
The buttons appear in both locations, but only the footer button works, when the in-line button (the one coded in the HTML block) is clicked, the whole page just refreshes instead of going to google.