Javascript function does not run online

0

The code below only works on localhost, online does not work, that is, works perfectly on my machine, when I transfer to the server, none of this works, I have already broken my head and could not solve it.

DETAIL - arquivo.js is within the root directory of http://loacalhost without intermediate paths, note:

<script type="text/javascript" language="javascript" src="arquivo.js"></script>
<script type="text/javascript" language="javascript" src="/arquivo.js"></script>
<script type="text/javascript" language="javascript" src="../arquivo.js"></script>

I ran local tests, with the three types mentioned above, and all went well. Already in the server http://xpg.uol.com.br I have done the same way leaving it in the root, but without success.

In a new attempt, I've included the contents of arquivo.js inside the HTML document (page index.html ), even so, no chance.

In another attempt with absolute path , relative to server configuration, being:

<script type="text/javascript" language="javascript" src="http://meusite.xpg.uol.com.br/arquivo.js"></script>

.. legal fun when put in localhost otherwise ... not even think.

Anyway, I seem to be in the scope of the function or even putting it on the page.

I'd like to understand where I'm going wrong. Thank you in advance, everyone's help.

    
asked by anonymous 18.05.2016 / 17:53

1 answer

0

To all who commented in answer to the question, I came to the conclusion. You had to change the following lines:

wrong onclick="nome(txt)"

I removed the txt it was not necessary to reference the <input type="text" id="txt"/> , and it looked like this:

onclick="nome()"

also:

wrong document.all.id.value;

Now, it's written like this:

document.getElementById('id').value;

  Ready!

     

For reasons I do not know, after modifying, the Javascript Function started to work on both the Client side and the Server side p>

    
18.05.2016 / 22:09