Changes

Jump to: navigation, search

Adding a Button that Runs a JavaScript

845 bytes added, 19:15, 4 August 2009
no edit summary
If you wish to have a button on the page that runs a custom [[Browser Script]] using the following technique:

1) Create a [[Custom Field Type: Display Only – Text or System Object|Display Only - Text or System Object Custom Field]]. In the '''Text/Link:''' section include the following:
<input type="button" class=Button value="Button Label" onClick='runThisScript()'/>

where:
* '''Button Label''' is the label you wish to have on the button
:and
* '''runThisScript()''' is the function you have defined separate in a [[Browser Script]] (step 2).


2) Create a [[Browser Script|Browser Script Custom Field]] that includes the [[JavaScript]] function you wish to run when the button is clicked:<br>
<pre>
function runThisScript()
{
// enter whatever the script should do here
}
</pre>



[[Category: Custom Fields]][[Category: JavaScript]]
0
edits

Navigation menu