home *** CD-ROM | disk | FTP | other *** search
/ Your Business Pak / BusinessPak2.iso / Netscape / CD / as.z / asw.jar / dns.js < prev    next >
Text File  |  1998-10-15  |  4KB  |  99 lines

  1. /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. <!--  to hide script contents from old browsers
  19.  
  20.  
  21.  
  22. function go(msg)
  23. {
  24.     if (parent.parent.globals.document.vars.editMode.value == "yes")
  25.         return true;
  26.     else
  27.         return(checkData());
  28. }
  29.  
  30.  
  31.  
  32. function checkData()
  33. {
  34.     if (document.forms[0].primaryDNS.value == "" && document.forms[0].secondaryDNS.value != "")    {
  35.         document.forms[0].primaryDNS.value = document.forms[0].secondaryDNS.value;
  36.         document.forms[0].secondaryDNS.value = "";
  37.         }
  38.  
  39.     if (document.forms[0].primaryDNS.value != "")    {
  40.         if (parent.parent.globals.verifyIPaddress(document.forms[0].primaryDNS.value)==false)    {
  41.             alert("The address of the primary DNS server is not valid. It should consist of digits separated by periods.");
  42.             document.forms[0].primaryDNS.focus();
  43.             document.forms[0].primaryDNS.select();
  44.             return(false);
  45.             }
  46.         }
  47.     if (document.forms[0].secondaryDNS.value != "")    {
  48.         if (parent.parent.globals.verifyIPaddress(document.forms[0].secondaryDNS.value)==false)    {
  49.             alert("The address of the secondary DNS server is not valid. It should consist of digits separated by periods.");
  50.             document.forms[0].secondaryDNS.focus();
  51.             document.forms[0].secondaryDNS.select();
  52.             return(false);
  53.             }
  54.         }
  55.     return(true);
  56. }
  57.  
  58.  
  59.  
  60. function loadData()
  61. {
  62.     // make sure all data objects/element exists and valid; otherwise, reload.  SUCKS!
  63.     if (((document.forms[0].domainName == "undefined") || (document.forms[0].domainName == "[object InputArray]")) ||
  64.         ((document.forms[0].primaryDNS == "undefined") || (document.forms[0].primaryDNS == "[object InputArray]")) ||
  65.         ((document.forms[0].secondaryDNS == "undefined") || (document.forms[0].secondaryDNS == "[object InputArray]")))
  66.     {
  67.         parent.controls.reloadDocument();
  68.         return;
  69.     }
  70.  
  71.     document.forms[0].domainName.value = parent.parent.globals.document.vars.domainName.value;
  72.     document.forms[0].primaryDNS.value = parent.parent.globals.document.vars.primaryDNS.value;
  73.     document.forms[0].secondaryDNS.value = parent.parent.globals.document.vars.secondaryDNS.value;
  74.     parent.parent.globals.setFocus(document.forms[0].domainName);
  75.     if (parent.controls.generateControls)    parent.controls.generateControls();
  76. }
  77.  
  78.  
  79.  
  80. function saveData()
  81. {
  82.     // make sure all form element are valid objects, otherwise just skip & return!
  83.     if (((document.forms[0].domainName == "undefined") || (document.forms[0].domainName == "[object InputArray]")) ||
  84.         ((document.forms[0].primaryDNS == "undefined") || (document.forms[0].primaryDNS == "[object InputArray]")) ||
  85.         ((document.forms[0].secondaryDNS == "undefined") || (document.forms[0].secondaryDNS == "[object InputArray]")))
  86.     {
  87.         parent.controls.reloadDocument();
  88.         return;
  89.     }
  90.  
  91.     parent.parent.globals.document.vars.domainName.value = document.forms[0].domainName.value;
  92.     parent.parent.globals.document.vars.primaryDNS.value = document.forms[0].primaryDNS.value;
  93.     parent.parent.globals.document.vars.secondaryDNS.value = document.forms[0].secondaryDNS.value;
  94. }
  95.  
  96.  
  97.  
  98. // end hiding contents from old browsers  -->
  99.