Author Topic: JavaScript onclick Event  (Read 168 times)

0 Members and 1 Guest are viewing this topic.

Offline Corps

  • Sr. Member
  • *
  • Posts: 282
  • Karma: +0/-0
    • View Profile
JavaScript onclick Event
« on: December 02, 2008, 03:06:23 AM »
Definition and Usage
The onclick event occurs when an object gets clicked.


Parameter Description
SomeJavaScriptCode Required. Specifies a JavaScript to be executed when the event occurs.

Supported by the following HTML tags:

Code: [Select]
<a>, <address>, <area>, , <bdo>, <big>,
, <body>, <button>, <caption>, <cite>, <code>, <dd>, <dfn>, <div>, <dl>, <dt>, , <fieldset>, <form>, <h1> to <h6>, [hr /], , <img>, <input>, <kbd>, <label>, <legend>, <li>, <map>, <object>, <ol>, <p>,
, <samp>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, <th>, <thead>, <tr>, <tt>, <ul>, <var>

Supported by the following JavaScript objects:

button, document, checkbox, link, radio, reset, submit

In this example the text in the first input field will be copied to the second input field when a button is clicked:

Code: [Select]
<body>Field1: <input type="text" id="field1" value="Hello World!">
[br /]
Field2: <input type="text" id="field2">
[br /][br /]
Click the button below to copy the content of Field1 to Field2.
[br /]
<button onclick="document.getElementById(\'field2\').value=
document.getElementById(\'field1\').value">Copy Text</button></body>

Techronnati | where technology never sleeps

JavaScript onclick Event
« on: December 02, 2008, 03:06:23 AM »

Mountain View


Related Topics

  Subject / Started by Replies Last post
0 Replies
Last post December 02, 2008, 06:29:03 AM
by MrSpecialist
0 Replies
Last post December 02, 2008, 06:35:26 AM
by MrSpecialist
0 Replies
Last post December 02, 2008, 07:03:40 AM
by MrSpecialist
1 Replies
Last post January 16, 2010, 04:59:46 PM
by MrSpecialist
0 Replies
Last post May 05, 2010, 10:53:02 AM
by EtemiaImpaine

Posting Disclaimer: Any individual may post a message in this forum and may do so anonymously. Therefore, the sole author is exclusively and entirely responsible for all opinions in that message. They do not represent the official opinions of Techronnati, its administrators or moderators or the Techronnati Management. Techronnati is merely acting as an impartial conduit for constitutionally protected free speech and is not responsible and will not be held liable for the content of such messages. All images and service logos are trademarks of their respective owners.