Running Javascript code when a button is clicked is straightforward with Iron Speed Designer using the pass-through attribute mechanism on the button’s Properties dialog.
To access the Page Properties dialog, double-click the button control in the Design tab in Iron Speed Designer. Then, go to the Attributes tab to add a new attribute with the appropriate name and value.
The easiest way to understand this mechanism is by example.
This example displays a message in the browser window status bar as you mouse over a button.
|
Pass-Through Attribute |
Value |
|
Button-HtmlAttributes-onMouseMove |
javascript:window.status='Press to Save Data...'; |
|
Button-HtmlAttributes-onMouseOut |
javascript:window.status=' ' |
You can display a confirmation dialog when the application user clicks a Delete button.
|
Pass-Through Attribute |
Value |
|
Button-HtmlAttributes-onClick |
javascript:return confirm("Are you sure?"); |
|
Button-HtmlAttributes-onClientClick OnClientClick is an alternative to OnClick |
javascript:return confirm("Are you sure?"); |
This example displays a message in the browser window status bar as you mouse over a button a displays a confirmation dialog when the button is clicked.
|
Pass-Through Attribute |
Value |
|
Button-HtmlAttributes-onClick |
javascript:return confirm("Are you sure?"); |
|
Button-HtmlAttributes-onMouseMove |
javascript:window.status='Press to Close...'; |
|
Button-HtmlAttributes-onMouseOut |
javascript:window.status=' ' |
Ensure that JavaScript is enabled in your web browser.