Javascript Joomla登记表及条款;条件复选框

Javascript Joomla登记表及条款;条件复选框,javascript,html,joomla,Javascript,Html,Joomla,我使用的是joomla 1.5,需要添加一个带有条款和条件名称的复选框。我已经使用了下面的代码,但它没有完全工作。即使我勾选了复选框,它也会发出警报 <script type="text/javascript"><!-- function checkAgree() { var agree = document.getElementById('formAgree'); if (!agree.checked) { alert

我使用的是joomla 1.5,需要添加一个带有条款和条件名称的复选框。我已经使用了下面的代码,但它没有完全工作。即使我勾选了复选框,它也会发出警报

<script type="text/javascript"><!--

 function checkAgree() {
     var agree = document.getElementById('formAgree');         
     if (!agree.checked) {
        alert('To become a member you must agree to our terms of service!');
        return false;
     } 
     return true;
 }

--></script>
<form action="<?php echo JRoute::_( 'index.php?option=com_user' ); ?>" method="post" id="josForm" name="josForm" class="form-validate" onsubmit="return checkAgree();">

<?php

 // Terms of Service

 $tokenHTML = str_replace('type="hidden"','id="formAgree" type="checkbox"',JHTML::_( 'form.token' ));

 $tosURL = "tos.html"; // REPLACE THIS!

?>
<tr>
   <td height="40" style="vertical-align: top;">
      <label>
         Terms of service:         
      </label>
   </td>
   <td>
      <iframe src="<?php echo htmlentities($tosURL); ?>" width="307" height="150"></iframe>
   </td>
</tr>
<tr>
  <td colspan="2">
    <p><?php echo $tokenHTML; ?> <b>Agree to terms of service.</b> *</p>
  </td>
</tr>
<tr>

服务条款:

在这类问题上有什么帮助吗?
checkAgree()
函数中的
agree
值是多少??签入控制台。
if ($("#formAgree").not(":checked")) {
  alert('To become a member you must agree to our terms of service!');
    return false;
} 
 return true;