home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 October / Chip Ekim 2003.iso / prog / code / contr / setup.exe / Disk1 / data1.cab / Configuration_En / Commands / ImageOptions.js < prev    next >
Encoding:
JavaScript  |  2003-07-18  |  2.4 KB  |  107 lines

  1. //
  2. // Copyright 2001, 2002, 2003 Macromedia, Inc. All rights reserved.
  3. // ----------------------------------------------------
  4. //
  5. // Accessibility.js
  6. //
  7. // This command adds 
  8. // 
  9. //
  10. // Version 1.0
  11. // Added functions...
  12. // ----------------------------------------------------
  13.  
  14.  
  15. var globalFormItem;
  16. var returnTag='';
  17. var helpDoc = MM.HELP_objImageAccessOptions;
  18.  
  19. function commandButtons() {
  20.    return new Array(MM.BTN_OK,         "setImageStr();window.close()",
  21.                     MM.BTN_Cancel,     "window.close()",
  22.                     MM.BTN_Help,       "displayHelp()"    );
  23.  
  24.  
  25. }
  26.  
  27. function isDOMRequired() { 
  28.     // Return false, indicating that this object is available in code view.
  29.     return false;
  30. }
  31.  
  32. function setFormItem(formItem) {
  33.     globalFormItem = formItem;
  34.     returnTag = globalFormItem;
  35. }
  36.  
  37. function setImageStr()
  38. {
  39.     var rtnStr='';
  40.  
  41.     rtnStr= globalFormItem;
  42.  
  43.  
  44. ////////////////////////////////////////////////////////////////
  45. // Attributes: Compose rtnStr with the attributes that have a value
  46. // Possible attributes are: alt and longdesc
  47.  
  48.  
  49. // if 'alt attribute' has a value, apply it to the initStr
  50.  
  51.     altValue=document.forms[0].alt.value;
  52.     if( (altValue == null) || (altValue == "") ){} 
  53.     else {
  54.         rtnStr= addAttribute("alt", altValue, rtnStr);
  55.     }
  56.  
  57. // if 'longdesc attribute' has a value, apply it to the initStr
  58.  
  59.     longdescValue=document.forms[0].longdesc.value;
  60.  
  61.     if( (longdescValue == null) || (longdescValue == "") || (longdescValue == "http://") ){} 
  62.     else {
  63.         rtnStr= addAttribute("longdesc", longdescValue, rtnStr);
  64.     }
  65.  
  66.  
  67.     returnTag= rtnStr;
  68. }
  69.  
  70. function returnAccessibilityStr () {
  71.  
  72.     return returnTag;
  73. }
  74.  
  75. ///////////////////////////////////////////////////////////////
  76. // other functions
  77. //////////////////////////////////////////////////////////////
  78. function initUI(){
  79.   document.forms[0].alt.focus();
  80. }
  81.  
  82. function addAttribute(tagName, tagVal, initStr){
  83.  
  84.     arrayElem= initStr.split(">");
  85.     rtnStr= arrayElem[0] + " " + tagName + "=" + '\"' + tagVal + '\"' + ">" + arrayElem[1];
  86.     
  87.     return rtnStr;
  88. }
  89.  
  90.  
  91. function getImageSrc(tagStr){
  92.  
  93.     arrayElements= tagStr.split("src=\"");
  94.     arrayStrings=  arrayElements[1].split("\"");
  95.     src= arrayStrings[0];
  96.     return src;
  97. }
  98.  
  99. function browseForURL(){
  100.   var urlField = document.forms[0].browseBtn.value;
  101.   var url = dw.browseForFileURL('select');
  102.   if (url != ""){
  103.     document.longdesc.value = url;
  104.     document.longdesc.focus();
  105.   }
  106. }
  107.