Try OpenEdge Now
skip to main content
WebSpeed Essentials
Tools and ABL Support : Language support : SpeedScript and CGI wrappers : 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 applications, while JavaScript is a good programming tool for adding user interface elements to Web applications.
If you use either the Report or Detail templates 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 templates will help you create SpeedScript to implement database queries and updates, and they will create JavaScript event handlers (like onMouseOver, onClick, etc.) to implement interactive features of the 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 in the following example:
<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.