Try OpenEdge Now
skip to main content
Developing WebSpeed Applications
Using JavaScript with WebSpeed : SpeedScript versus JavaScript
 

SpeedScript versus JavaScript

It is a common practice to use both SpeedScript and JavaScript when developing WebSpeed applications. SpeedScript has advantages for developing the business logic of a applications, while JavaScript is a good programming tool for adding user interface elements to Web applications.
If you use either the Report or Detail Wizards in AppBuilder to create a WebSpeed Web object, you can view the resulting HTML source file and see a combination of SpeedScript and JavaScript. The wizards create SpeedScript to implement database queries and updates, and they create JavaScript event handlers (like onMouseOver, onClick, etc.,) to implement interactive features of WebSpeed applications.
The <SCRIPT> tag for JavaScript employs the same syntax as the <SCRIPT> tag for Embedded SpeedScript, as shown:
<SCRIPT LANGUAGE="JavaScript">
JavaScript Code
</SCRIPT>
In some situations, you do not need a <SCRIPT> tag. JavaScript event handlers, for example, do not require a <SCRIPT> tag when they are used as an attribute to an HTML tag, as shown:
<BODY onLoad="alert('Done');">
Some other factors that you should keep in mind when using JavaScript in WebSpeed applications are:
*End users of your WebSpeed application will be able to see your JavaScript code when they view HTML source in their browsers. They can see the HTML output that Embedded SpeedScript generates, but they do not see the actual SpeedScript source code. (This is because the SpeedScript code executes on the server side while the JavaScript executes on the client-side browser.)
*No static or dynamic HTML can be generated from the JavaScript code that is between HTML <SCRIPT> tags.
*SpeedScript is executed on the server side by the WebSpeed agent. JavaScript is executed on the client side by the Web browser.