title: html onclick run javascript function not working
body: <p>I'm trying to run a javascript menthod on an input="image" in html. My code in my html looks like this:</p>
  
  <pre><code>onclick="manageHandlers('Unassign'); document.getElementsByName('manageHandlers')[0].submit(); "
  </code></pre>
  
  <p>and in my javascript the method is like this:</p>
  
  <pre><code>function manageHandlers(parameter){
     alert("It's working: "+parameter);
  }
  </code></pre>
  
  <p>Is there something I'm doing wrong? I could sware this worked yesterday but today it's just not doing anything.</p>
  
  <p>Thanks for looking at this!</p>
  
  <p>full html code:</p>
  
  <pre><code>    &lt;%-- 
      Document   : pathologist
      Created on : 16 Nov 2011, 09:53:58 AM
      Author     : dean.grobler
  --%&gt;
  &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
      "http://www.w3.org/TR/html4/loose.dtd"&gt;
  
  &lt;%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%&gt;
  &lt;%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %&gt;
  &lt;%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %&gt;
  
  &lt;%@ page import="javax.portlet.*"%&gt;
  &lt;%@ page import="co.za.lancet.medelogget.*" %&gt;
  &lt;%@ page import="java.util.ArrayList" %&gt;
  &lt;%@ page import="com.liferay.portal.kernel.servlet.*" %&gt;
  &lt;%@page import="com.liferay.portal.kernel.util.Validator" %&gt;
  
  &lt;portlet:defineObjects /&gt;
  
  &lt;%
      String editable = request.getParameter("editable");
      String selectedValue = request.getParameter("selectedValue");
      int selectedIndex = 0;
      if (selectedValue != null) {
          selectedIndex = Integer.parseInt(selectedValue);
      }
      ArrayList&lt;String&gt; data = tableData.getTableData(selectedIndex, "consumers", "code");
      String AvailableJavaScript = tableData.consumersAvailableHandlers(data.get(0));  
      String AssignedJavaScript = tableData.consumersAssignedHandlers(data.get(0)); //data.get(0) is the whereclause    
  
  %&gt;
  
  &lt;!-- -------------------------Interface Starts here------------------------- --&gt;
  
  &lt;aui:layout&gt;
      &lt;form name="consumerDetails" action="&lt;portlet:actionURL &gt;&lt;portlet:param name="consumers" value="consumers"/&gt;&lt;/portlet:actionURL&gt;" method="post"&gt;
          &lt;input type="hidden" value="consumers" name="formType" /&gt;
          &lt;input type="hidden" value="&lt;%=selectedValue%&gt;" name="selectedValue" /&gt;
  
  
  
      &lt;input type="hidden" value="" id="button" name='button' /&gt;
      &lt;aui:column columnWidth="50"&gt;
          &lt;h3&gt;
              &lt;%if (editable.equals("")) {%&gt;
              Edit Consumer
              &lt;%} else {%&gt;
              Consumer Details 
              &lt;%}%&gt;
              &lt;%%&gt;
          &lt;/h3&gt;   
          &lt;div class="horizontalRules"&gt;&lt;hr class&gt;&lt;/div&gt;
          &lt;div id="successAndErrorMessages"&gt;&lt;/div&gt;
  
          &lt;table width="100%"&gt;
              &lt;tr height="35px"&gt;&lt;td width="25%"&gt;Code:&lt;/td&gt;&lt;td&gt;&lt;input type="text" value="&lt;%=data.get(0)%&gt;" name="code"  class="textBoxes" &lt;%=editable%&gt;&gt;&lt;/td&gt;&lt;/tr&gt;
              &lt;tr height="35px"&gt;&lt;td width="25%"&gt;Description:&lt;/td&gt;&lt;td&gt;&lt;input type="text" value="&lt;%=data.get(1)%&gt;" name="description"  class="textBoxes" &lt;%=editable%&gt;&gt;&lt;/td&gt;&lt;/tr&gt;           
          &lt;/table&gt;
      &lt;/aui:column&gt;    
  
      &lt;/form&gt;
      &lt;/aui:layout&gt;
  
      &lt;!-- --------------------Handler rules section---------------------- --&gt;        
      &lt;%if (editable.equals("")) {%&gt;
  
      &lt;aui:layout&gt;
          &lt;aui:column columnWidth="100"&gt;
              &lt;h3&gt;Manage Handler Rules&lt;/h3&gt;
              &lt;div class="horizontalRules"&gt;&lt;hr class&gt;&lt;/div&gt;                        
              &lt;/aui:column&gt;
          &lt;/aui:layout&gt;
  
      &lt;aui:layout&gt;
  
          &lt;form name="manageHandlers" id="formType" action="&lt;portlet:actionURL &gt;&lt;portlet:param name="manageHandlers" value="manageHandlers"/&gt;&lt;/portlet:actionURL&gt;" method="post"&gt;
  
              &lt;!-- index selected in handlers tables --&gt;
              &lt;input type="hidden" name="selectedHandler" id="selectedHandler" /&gt; 
              &lt;input type="hidden" value="" id="handlerButton" name='handlerButton' /&gt;
              &lt;input type="hidden" value="" id="button" name='button' /&gt;
              &lt;input type="hidden" value="" id="tableType" name='tableType' /&gt;
              &lt;input type="hidden" value="manageHandlers" name="formType" /&gt;
  
              &lt;table width="100%"&gt;
                  &lt;tr&gt;&lt;td width="35%"&gt;&lt;table width="100%"&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;&lt;h4 style="margin-bottom: 10px;"&gt;Available Rules&lt;/h4&gt;&lt;/td&gt;
                              &lt;/tr&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;&lt;div class="availableTable" id='available_div'&gt;&lt;/div&gt;&lt;/td&gt;
                              &lt;/tr&gt;
                          &lt;/table&gt;&lt;/td&gt;
  
                      &lt;td width="15%"&gt;&lt;div class="manageHandlersButtons1"&gt;
                              &lt;table width="100%"&gt;
                                  &lt;tr&gt;
                                      &lt;td&gt;&lt;h4&gt;Fatal Error:&lt;/h4&gt;&lt;/td&gt;
                                  &lt;/tr&gt;
                                  &lt;tr&gt;
                                      &lt;td&gt;&lt;input type="checkbox" id="fatal" name="fatal" class="manageHandlersCheckbox" value="1" /&gt;&lt;/td&gt;                                        
                                  &lt;/tr&gt;
                                  &lt;tr&gt;
                                      &lt;td&gt;&lt;input type="image" id="button" value="Assign" src="&lt;%=renderRequest.getContextPath()%&gt;/Images/rightarrow.png" alt="Assign Selected Rule" class="imgAssignUnassign" onclick="if(manageHandlers('Assign')){ document.getElementsByName('manageHandlers')[0].submit(); }" /&gt;&lt;/td&gt;
                                  &lt;/tr&gt;
                                  &lt;tr&gt;
                                      &lt;td&gt;&lt;input type="image" id="button" value="Unassign" src="&lt;%=renderRequest.getContextPath()%&gt;/Images/leftarrow.png" alt="Unassign Selected Rule" class="imgAssignUnassign" onclick="manageHandlers('Unassign'); document.getElementsByName('manageHandlers')[0].submit(); " /&gt;&lt;/td&gt;
                                  &lt;/tr&gt;
                              &lt;/table&gt;
                          &lt;/div&gt;&lt;/td&gt;
  
                      &lt;td width="35%"&gt;&lt;table width="100%"&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;&lt;h4 style="margin-bottom: 10px;"&gt;Assigned Rules&lt;/h4&gt;&lt;/td&gt;
                              &lt;/tr&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;&lt;div class="assignedTable" id='assigned_div'&gt;&lt;/div&gt;&lt;/td&gt;
                              &lt;/tr&gt;
                          &lt;/table&gt;&lt;/td&gt;
  
                      &lt;td width="15%"&gt;&lt;div class="manageHandlersButtons2"&gt;
                              &lt;table width="100%"&gt;
                                  &lt;tr&gt;
                                      &lt;td&gt;&lt;input type="button" id="button" name="MoveUp" value="MoveUp" style="width: 85px;" class="manageHandlersMvUp" onclick="if(manageHandlers('Move up')){ document.getElementsByName('manageHandlers')[0].submit(); }" /&gt;&lt;/td&gt; 
                                  &lt;/tr&gt;
                                  &lt;tr&gt;
                                      &lt;td&gt;&lt;input type="button" id="button" name="MoveDown" value="MoveDown" style="width: 85px;" class="manageHandlersMvDwn" onclick="if(manageHandlers('Move down')){ document.getElementsByName('manageHandlers')[0].submit(); }" /&gt;&lt;/td&gt;
                                  &lt;/tr&gt;
                              &lt;/table&gt;&lt;/div&gt;
  
                      &lt;/td&gt;&lt;/tr&gt;
              &lt;/table&gt;
          &lt;/form&gt;                                
  
      &lt;/aui:layout&gt;        
  
      &lt;div class="horizontalRules2"&gt;&lt;hr class&gt;&lt;/div&gt;          
  
      &lt;%}%&gt;
  
      &lt;table width="100%"&gt;
          &lt;tr&gt;
              &lt;td width="25%"&gt;&lt;input type="button" value="Back" style="width: 80px;" class="leftButtons"  onClick="document.getElementById('button').value='Back'; document.getElementsByName('consumerDetails')[0].submit()" /&gt;&lt;/td&gt;
  
              &lt;!-- if not editable, don't display this button --&gt;
              &lt;% if (editable.equals("")) {%&gt;                   
              &lt;td&gt;&lt;input type="button" value="Save" style="width: 80px;" class="rightButtons" onClick="if (addEntryValidator('Save','consumers','edit')) {document.getElementsByName('consumerDetails')[0].submit()}" /&gt;&lt;/td&gt;                    
                  &lt;% }%&gt;
          &lt;/tr&gt; 
      &lt;/table&gt;
  
      &lt;!-- JavaScript Tables --&gt;    
      &lt;script type="text/javascript"&gt;&lt;%= AssignedJavaScript%&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;&lt;%= AvailableJavaScript%&gt;&lt;/script&gt;
  </code></pre>