• No results found

In the drop-down list at the top of the Properties window, select DOCUMENT

6 USING THE CHART CONTROL 82

B.4 Ajax Example 166

2. In the drop-down list at the top of the Properties window, select DOCUMENT

4.2.16 Scripting Elements

SharePoint Designer 2007 uses the Microsoft Script Editor available from Tools | Macros menu to add scripts directly into your pages. Only JavaScript is supported on iPendant. Client-side scripts are supported. Server-side scripts are not. JavaScript functions should be placed within the header of your Web page. JavaScript placed within the body will be processed top to bottom. Sometimes it is necessary to perform different scripts based on the browser. To determine if the browser is iPendant use the

following:

var _ip = (navigator.userAgent.indexOf("IEMobile") >= 0);

if (_ip == true) {

The FANUC Robotics Server Side Include (SSI) directives are supported on iPendant. This provides dynamic information only when the page is displayed. Such information can include the current value of a program variable (part count, for example), current status of an I/O point, or the current error listing.

Please refer to the FANUC Robotics SYSTEM R-30iB Controller Internet Options Setup and Operations Manual for information on using SSI.

4.2.16.1 Adding Script

The Microsoft Script editor includes features that help you create scripts. You can create event handlers for elements on the page, which are scripts that run in response to actions such as when a user chooses a button, when a document first loads, or other events. You can also use editor features to create

standalone script blocks to contain any script, not only event handlers.

To set the DefaultClientScript property in the Properties window:

1. Open the page for which you want to set the DefaultClientScript property.

2. In the drop-down list at the top of the Properties window, select DOCUMENT.

3. In the Document section of the Properties window, click the DefaultClientScript property, and then select JavaScript for client event handlers.

If you are allowed to use regedit, you can change the default by searching for VBScript (Match whole string only) and setting the value of DefClientLanguage to JavaScript. It may be in several places.

The Script Outline window displays a tree view containing the object hierarchy for the client. Each script on the page appears as a node on the tree. Beneath each object, the hierarchy also contains a list of events supported by that object. If a handler exists for that event, the name of the event is displayed in bold. To create a new handler, double-click the name of the event. To jump to an existing script, click its node in the tree.

When you double click the event name, the editor performs the following actions:

• Creates or moves to one of the following script blocks at the top of the document, depending on where the script will run and what language it will be in:

• Inserts a new, blank event-handling procedure for the element and event you specified.

24

• If the script will be in JavaScript, adds an event attribute (for example, onclick=) to the element.

• Positions the insertion point at the second line of the new script, ready for you to enter commands.

For JavaScript functions, the format is:

function elementID_event(){

}

When creating JavaScript event handlers, the editor also adds the following attributes to the HTML element itself:

event="return elementID_event()"

If you are writing script, the HTML editor uses IntelliSense® — it displays options that help you complete statements. When you type in the name of an object available on your page followed by a period (.), the editor displays all members of that object's class.

25

4.2.16.2 Debugging in Source View

Source view enables you to execute debugger commands, such as setting breakpoints, by choosing commands from the Debug menu or the Debug toolbar. The left margin of the edit window displays glyphs indicating breakpoints.

When the debugger is running, the current page is displayed in Source view so you can see individual lines of script. The current line is indicated in the margin with an arrow indicator.

4.2.16.3 Debugging in Internet Explorer

26

While viewing your page in Internet Explorer on a PC, you can press F12. This brings up the Developer Tools. You can select Script, choose the web page, and press Start debugging. You can set breakpoints and watch variables. You have all the capabilities of a source code debugger.

4.2.16.4 Scripting iPendant Controls

You may create objects using JavaScript but then you cannot use the WYSIWYG editing capabilities in SharePoint Designer.

Here is an example of creating an object using JavaScript so the DataIndex can be calculated at run-time:

<SCRIPT LANGUAGE="JavaScript"><!--

var _reqvar = <!--#echo var = $BBSTART_DI.$PORT_NUM -->

_reqvar = _reqvar + 2

req = '<object

classid="clsid:7106066C-0E45-11D3-81B6-0000E206D65E" id="FRIPToggleButton1" width="87" height="50">\n' req +=' <param name="_Version" value="65536">\n'

req +=' <param name="_ExtentX" value="2302">\n' req +=' <param name="_ExtentY" value="1323">\n' req +=' <param name="_StockProps" value="15">\n' req +=' <param name="Caption" value="+X">\n' req +=' <param name="ForeColor" value="0">\n'

req +=' <param name="BackColor" value="16776960">\n' req +=' <param name="DataType" value="1">\n'

req +=' <param name="DataIndex" value="' + _reqvar + '">\n' req +=' <param name="Border" value="4">\n'

req +=' <param name="Type" value="0">\n' req +=' <param name="ViewType" value="0">\n'

req +=' <param name="TrueColor" value="12632256">\n'

req +=' <param name="FalseColor" value="16776960">\n'

req +=' <param name="TrueStrColor" value="0">\n'

req +=' <param name="FalseStrColor" value="0">\n'

req +=' <param name="TrueValue" value="0">\n'

req +=' <param name="FalseValue" value="0">\n'

req +=' <param name="TrueImage" value>\n'

req +=' <param name="FalseImage" value>\n'

req +=' <param name="OtherPhase" value="-1">\n'

req +='</object>'