home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 January / 01_02.iso / software / netscape62win / browser.xpi / bin / chrome / comm.jar / content / editor / EdImageMapHotSpot.js < prev    next >
Encoding:
JavaScript  |  2001-05-02  |  2.7 KB  |  92 lines

  1. /*
  2.  * The contents of this file are subject to the Netscape Public
  3.  * License Version 1.1 (the "License"); you may not use this file
  4.  * except in compliance with the License. You may obtain a copy of
  5.  * the License at http://www.mozilla.org/NPL/
  6.  *
  7.  * Software distributed under the License is distributed on an "AS
  8.  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  9.  * implied. See the License for the specific language governing
  10.  * rights and limitations under the License.
  11.  *
  12.  * The Original Code is Mozilla Communicator client code, released
  13.  * March 31, 1998.
  14.  *
  15.  * The Initial Developer of the Original Code is Netscape
  16.  * Communications Corporation. Portions created by Netscape are
  17.  * Copyright (C) 1998-2000 Netscape Communications Corporation. All
  18.  * Rights Reserved.
  19.  *
  20.  * Contributor(s):
  21.  *   Dan Haddix
  22.  */
  23.  
  24. var dialog;
  25.  
  26. // dialog initialization code
  27. function Startup()
  28. {
  29.   if (!InitEditorShell())
  30.     return;
  31.  
  32.   doSetOKCancel(onOK, onCancel); // Map OK/Cancel to relevant functions
  33.  
  34.   // Create dialog object to store controls for easy access
  35.   dialog = new Object;
  36.   dialog.urlInput = document.getElementById("urlInput");
  37.   dialog.targetInput = document.getElementById("targetInput");
  38.   dialog.altInput = document.getElementById("altInput");
  39.   dialog.commonInput = document.getElementById("commonInput");
  40.  
  41.   dialog.hsHref = window.arguments[0].getAttribute("hsHref");
  42.   if (dialog.hsHref != '')
  43.     dialog.urlInput.value = dialog.hsHref;
  44.  
  45.   dialog.hsAlt = window.arguments[0].getAttribute("hsAlt");
  46.   if (dialog.hsAlt != '')
  47.     dialog.altInput.value = dialog.hsAlt;
  48.  
  49.   dialog.hsTarget = window.arguments[0].getAttribute("hsTarget");
  50.   if (dialog.hsTarget != ''){
  51.     dialog.targetInput.value = dialog.hsTarget;
  52.     len = dialog.commonInput.length;
  53.     for (i=0; i<len; i++){
  54.       if (dialog.hsTarget == dialog.commonInput.options[i].value)
  55.         dialog.commonInput.options[i].selected = "true";
  56.     }
  57.   }
  58.  
  59.   SetTextboxFocus(dialog.urlInput);
  60.  
  61.   SetWindowLocation();
  62. }
  63.  
  64. function onOK()
  65. {
  66.   dump(window.arguments[0].id+"\n");
  67.   window.arguments[0].setAttribute("hsHref", dialog.urlInput.value);
  68.   window.arguments[0].setAttribute("hsAlt", dialog.altInput.value);
  69.   window.arguments[0].setAttribute("hsTarget", dialog.targetInput.value);
  70.  
  71.   SaveWindowLocation();
  72.  
  73.   window.close();
  74. }
  75.  
  76. function changeTarget() {
  77.   dialog.targetInput.value=dialog.commonInput.value;
  78. }
  79.  
  80. function chooseFile()
  81. {
  82.   // Get a local file, converted into URL format
  83.  
  84.   fileName = GetLocalFileURL("html");
  85.   if (fileName && fileName != "") {
  86.     dialog.urlInput.value = fileName;
  87.   }
  88.  
  89.   // Put focus into the input field
  90.   SetTextboxFocus(dialog.urlInput);
  91. }
  92.