Adobe Extending Dreamweaver CS4 Uživatelský manuál Strana 90

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 387
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 89
84
EXTENDING DREAMWEAVER CS4
User interfaces for extensions
The following example shows the settings for an editable select list:
<select name="travelOptions" style="width:250px" editable="true" editText="other
(please specify)">
<option value="plane">plane</option>
<option value="car">car</option>
<option value="bus">bus</option>
</select>
When you use select lists in your extensions, check for the presence and value of the editable attribute. If no value is
present, the select list returns the default value of
false, which indicates that the select list is not editable.
As with standard noneditable select lists, editable select lists have a selectedIndex property (see Objects, properties,
and methods of the Dreamweaver DOM” on page 96). This property returns -1 if the text box is selected.
To read the value of an active editable text box into an extension, read the value of the editText property. The
editText property returns the string that the user entered into the editable text box or the value of the editText
attribute. If no text has been entered and no value has been specified for
editText, it returns an empty string.
Dreamweaver adds the following custom attributes for the select tag to control editable pop-up menus:
Note: Editable select lists are available in Dreamweaver.
The following example creates a Command extension that contains an editable select list using common JavaScript
functions:
Create the example
1 Create a new blank file in a text editor.
2 Enter the following code:
<html>
<head>
<title>Editable Dropdown Test</title>
<script language="javascript">
function getAlert()
{
var i=document.myForm.mySelect.selectedIndex;
if (i>=0)
{
alert("Selected index: " + i + "\n" + "Selected text " +
document.myForm.mySelect.options[i].text);
}
else
{
alert("Nothing is selected" + "\n" + "or you entered a value");
}
}
function commandButtons()
{
return new Array("OK", "getAlert()", "Cancel", "window.close()");
Attribute name Description Accepted values
editable Declares that the pop-up menu has an editable text area A Boolean value of true or
false
editText Holds or sets text within the editable text area A string of any value
Zobrazit stránku 89
1 2 ... 85 86 87 88 89 90 91 92 93 94 95 ... 386 387

Komentáře k této Příručce

Žádné komentáře