Newsgroup: it.comp.lang.javascript
Titolo: Script per password.

Salve,
ho un piccolo problema che non riesco a risolvere. Come faccio a
indirizzare uno script su un'altra directory?
Lo script in questione e' questo:
<SCRIPT language="JavaScript">
  <!-- Key-code script by Bart Jellema
    // You may use this script freely as long
    // as you credit me for it...
    var usermulcode=24
        // This is to validate the code. In this case
        // the code is 1234 so the mul = 1*2*3*4 = 24
        // Change this value for your own code
        // If your code is 2415 it will be
        // usermulcode = 40 (2*4*1*5)
    var code=0   // the entered code
    var mul=1    // the multiplied digits
    var digit=0  // number of digits entered so far
    var fails=0  // number of tries done
    function Enter_code(number)
    {
 
      code=code*10+number         // Add the digit to the code
      mul=mul*number              // Update mul-value
      document.codepad.thecode.value=code  // Show code
      digit++                     // Increase digit
 
      if (digit==4)               // Four digits entered
      {
        if (mul==24)              // This is to validate
                                  // the code. In this case
                                  // the code is 1234 so the
                                  // mul = 1*2*3*4 = 24
                                  // Change this value for
                                  // your own code
        {
          location=code+".html"
        }
        else
        {
          fails++                 // Increase fails
          code=0                  // Reset values
          mul=1
          digit=0
          if (fails<3)            
          {
            if (fails==1)
            {document.codepad.thecode.value="riprova"}
            if (fails==2)
            {document.codepad.thecode.value="ultima volta"}
          }
          else                    // To many tries = worp back 
          {
            location="java.htm"
            document.codepad.thecode.value="A presto!"
          } 
        }
      }
    }
    function keycodepad(mulcode)
    {
      usermulcode=mulcode
      document.write("<form name=\"codepad\">");
      document.write("<input type=\"button\" value=\" 1 \"
onClick=\"Enter_code(1)\">");
      document.write("<input type=\"button\" value=\" 2 \"
onClick=\"Enter_code(2)\">");
      document.write("<input type=\"button\" value=\" 3 \"
onClick=\"Enter_code(3)\"><br>");
      document.write("<input type=\"button\" value=\" 4 \"
onClick=\"Enter_code(4)\">");
      document.write("<input type=\"button\" value=\" 5 \"
onClick=\"Enter_code(5)\">");
      document.write("<input type=\"button\" value=\" 6 \"
onClick=\"Enter_code(6)\"><br>");
      document.write("<input type=\"button\" value=\" 7 \"
onClick=\"Enter_code(7)\">");
      document.write("<input type=\"button\" value=\" 8 \"
onClick=\"Enter_code(8)\">");
      document.write("<input type=\"button\" value=\" 9 \"
onClick=\"Enter_code(9)\"><br>");
      document.write("<input type=\"text\" name=\"thecode\" size=10
value=\"\"><br>");
      document.write("</form>");
    }
  // Key-code script by Bart Jellema -->
</SCRIPT>
</HEAD>
<BODY>
<FORM name="codepad"><INPUT type="button" value=" 1 "
onClick="Enter_code(1)"><INPUT type="button" value=" 2 "
onClick="Enter_code(2)"><INPUT type="button" value=" 3 "
onClick="Enter_code(3)"><BR><INPUT type="button" value=" 4 "
onClick="Enter_code(4)"><INPUT type="button" value=" 5 "
onClick="Enter_code(5)"><INPUT type="button" value=" 6 "
onClick="Enter_code(6)"><BR><INPUT type="button" value=" 7 "
onClick="Enter_code(7)"><INPUT type="button" value=" 8 "
onClick="Enter_code(8)"><INPUT type="button" value=" 9 "
onClick="Enter_code(9)"><BR><INPUT type="text" name="thecode" size=10
value=""><BR></FORM>
</BODY>
Qusto script funziona solo se il file che richiama si trova nella stessa
directory. 
Se invece dovesse essere posizionato su un'altra directory come dovrei
fare????
Grazie della collaborazione

           location=code+".html"
Dovrebbe essere qui:
prova con
            location="tuadir\"+code+".html"
--
ciao
gelty
--
Visita 
http://www.sifor.it
Elimina *toglimi* per le risposte