title: How to call javascript function from html without using any event
body: <p>I am trying to set value of a div by calling a javascript function. below is the divs(for rating) in a gridview.</p>
  
  <p>in the below code the function is called from value="" but it is not working</p>
  
  <p>Is it possible to call a javascript function from html other than on an event (other than onclick etc..)</p>
  
  <p>What is the other alternative for doing this</p>
  
  <pre><code>                &lt;asp:TemplateField HeaderText="Rating" HeaderStyle-HorizontalAlign="Left"&gt;
                  &lt;ItemTemplate&gt;
                      &lt;div class="rateit" id="divrate1"&gt;&lt;/div&gt;rate1
                      &lt;br /&gt;&lt;div class="rateit" id="divrate2"&gt;&lt;/div&gt;rate2
                      &lt;br /&gt;&lt;div class="rateit" id="divrate3"&gt;&lt;/div&gt;rate3
                      &lt;br /&gt;Rate&lt;div class="rateit" id="divrate4"&gt;&lt;/div&gt;rate4
  
  
                      &lt;input type="hidden" id="test2" runat="server"   value="javascript:SetRates(
                              '&lt;%#((GridViewRow)Container).RowIndex %&gt;',
                              '&lt;%#Eval("Rev1","{0}")%&gt;',
                              '&lt;%#Eval("Rev2","{0}")%&gt;',
                              '&lt;%#Eval("Rev3","{0}")%&gt;',
                              '&lt;%#Eval("Rev4","{0}")%&gt;');return false;" /&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>javascript function </p>
  
  <pre><code>function SetRates(RowIndx,vRt,uRt,dRt,nRt){
  
          RowIndx=parseInt(RowIndx)+1;
          var drvDiv=$(document.getElementById('&lt;%=GridView2.ClientID %&gt;').rows[RowIndx]).find('.rateit');
          $(drvDiv[0]).rateit('value', vRt);
          $(drvDiv[1]).rateit('value', uRt);
          $(drvDiv[2]).rateit('value', dRt);
          $(drvDiv[3]).rateit('value', nRt);
          $(drvDiv[3]).rateit('readonly',true);
          return 1;
       }
  </code></pre>
  
  <p>btw where can i find documentation for negative marks for a query in SO?</p>