[Javascript] Prototype: events on buttons

Michael Borchers list at tridemail.de
Mon Jan 7 03:34:26 CST 2008


----- Original Message ----- 
  From: Michael Borchers 
  To: [JavaScript List] 
  Sent: Monday, January 07, 2008 10:24 AM
  Subject: [Javascript] Prototype: events on buttons


  I noticed a strange behaviour in Prototype.
  I simply call a function, f.e. with an simple AJAX Request, named request():
  The file's name is my_file.php.

  <input type="button" name="butt1" value="request me" onclick="javascript:request();">
  <input type="button" name="butt2" value="request me" onclick="request();">
  <a href="javascript:request();">No button</a>

  When using the link, the function works fine and Firebug shows me the correct URL of the calles AJAX script,
  f.e.: http::www.mydomain.com/test/my_ajax.php

  But when clicking the button, the called URL is http::www.mydomain.com/test/my_file.php and nothing happens.

  It only appears when working with Prototype, it works fine with normal HTML/JS.

  Is this a prototype bug or feature for input buttons?
   Additionally I found out that it only happens when the function name ist "request", so this might be a reserved name
Prototpye. But still I don't understand why it works called by a link and not by a button. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20080107/caa36408/attachment.htm>


More information about the Javascript mailing list