Jump to content

New simpe question, but for me very difficult!


DeeDee2010

Recommended Posts

As you helped me creating my script to upload automatically new transaction number, I once again ask for help with a code snippet. Here is the code.

 

<script language="JavaScript">function PasswordLogin()
{ document.location.href = document.formlogin.trackingnr.value + ".html";
return false;
}
function CheckEnter(event)
{
var NS4 = (document.layers) ? true : false;
var code = 0;
if (NS4)
code = event.which;
else
code = event.keyCode;
if (code==13)
{ PasswordLogin();
event.returnValue = false;
}
}</script>

 

It works well, but I don't know what to modify in order to search the document in another folder. For example, now it only searches the document entered only in the folder where the script (which is in a html page), and I would like it to look for the document in a folder let's say "transactions" which is down one level, or up one level. What should I modify? Can you help please? Thanks

Link to comment
Share on other sites

Sorry, I posted the wrong code :(

 

Here is it, complete with the form:

 

<script type="text/javascript">

function PasswordLogin()
{
    var filename = document.formlogin.trackingnr.value.toUpperCase() + ".html";
    var http = window.XMLHttpRequest
        ? new XMLHttpRequest()
        : new ActiveXObject('MSXML2.XMLHTTP.3.0');  

    if (!http)
    {
        window.location = filename;
        return false;
    }   

    http.open('GET', filename, true);
    http.onreadystatechange = function()
    {
        if (http.readyState == 4)
        {
            if (http.status == 200)
            {
                window.location = filename;
            }
            else
            {
                alert('Votre Numero est errone. Merci de reessayer!');
                return false;
            }
        }
    }
    http.send(null);    
    return false;
}


                          </script>

 

 

Any Ideas on how to change the search location?

 

Here is the form:

 

<form action="" method="get" name="formlogin" onSubmit="return PasswordLogin();">
                                    
Numero de Depistage:
                                              <p>
                                                <input name="trackingnr" id="trackingnr" size="14" type="text" class="style112" onBlur="this.value = this.value || this.defaultValue; this.style.color = '#999';" 
onFocus="this.value=''; this.style.color = '#000';">
                                                <br>
                                                <input name="button" value="Suivi!" type="submit" style="background: #FF6600; color: white; font: 8pt bold Verdana, Arial, Helvetica, sans-serif">

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.