JS external file loaded in bad way

P

Pasquale

hello wverybody...
i've got a terrible matter with JS

my browsers (either IE and NN) load the external scripts uncorrectly...they
load the files from the half part of them and not from the beginning, so my
scripts don't work giving syntax errors.

can you give me a solution?
 
M

McKirahan

Pasquale said:
hello wverybody...
i've got a terrible matter with JS

my browsers (either IE and NN) load the external scripts uncorrectly...they
load the files from the half part of them and not from the beginning, so my
scripts don't work giving syntax errors.

can you give me a solution?


How many different groups are you going to post this at!
 
R

Randy Webb

Pasquale said:
hello wverybody...
i've got a terrible matter with JS

my browsers (either IE and NN) load the external scripts uncorrectly...they
load the files from the half part of them and not from the beginning, so my
scripts don't work giving syntax errors.

can you give me a solution?

Fix your browsers, or, post more detail. Perhaps a sample page that
shows the behavior.
 
P

Pasquale

i show here the translation of my problem from italian to english made by
google language tool ( i hope it will be not so bad).then there are the
files : accesso.php is a simple example of the strange behaviour and
articoli is something more complex (it has 2 external files)

the project one that I am developing has many functions JS that I have put
in external files. until a month ago they worked well... i stopped
developing for a month for personal reasons and now that I have resumed my
project I have noticed one matter... all the scripts come load evil from
the browsers i use (NN and MSIE), in the sense that, as the NN Javascript
console tells me, the files js with the functions come loaded incomplete,
that is do not from the beginning but from a particular point approximately
to the half of the file. that cause the loss of functions and obviously
syntax errors...

in the past month i installed some windows updates,
i use apache 2,0,52 on win xp sp2

help me... is my thesis of bachelor! thaks a lot
 
B

Brett Foster

Pasquale said:
i show here the translation of my problem from italian to english made by
google language tool ( i hope it will be not so bad).then there are the
files : accesso.php is a simple example of the strange behaviour and
articoli is something more complex (it has 2 external files)

Can't see the files. My news provider doesn't support files. Post as
text inside the message and try to make sure it's as simple an example
as possible.
the project one that I am developing has many functions JS that I have put
in external files. until a month ago they worked well... i stopped
developing for a month for personal reasons and now that I have resumed my
project I have noticed one matter... all the scripts come load evil from
the browsers i use (NN and MSIE), in the sense that, as the NN Javascript
console tells me, the files js with the functions come loaded incomplete,
that is do not from the beginning but from a particular point approximately
to the half of the file. that cause the loss of functions and obviously
syntax errors...

It's not a great translation, but I get the jist.
 
P

Pasquale

this is the simplier example :

php page

<head>
<link rel="stylesheet" type="text/css" href="stile.css">
<script src="scripts.js" type="text/javascript">
</script>

</head>

<body>
<?php
$login=$_POST['identita'];
$q="select password,nome from utenti where login='$login'";
$host="localhost";
$connessione=mysql_connect($host,null,null);
mysql_select_db('magazzino');
$risultato=mysql_query($q);
$riga=mysql_fetch_array($risultato,MYSQL_BOTH);
$pw=$riga[0];
$nome=$riga[1];
$tipo=$riga[2];
if ($pw!=$_POST['password']) {
echo "<h2>Accesso non autorizzato a MAST</h2> ";
echo "<h4>Controllare la password immessa per identificare l'utente</h4>";
echo "<center><img src=img/logo.bmp width=300 height=100>";
echo "<br><a href=index.html>Torna all'accesso</a>";
exit();
}
mysql_free_result($risultato);
mysql_close($connessione);
?>
<p>Redirezione alla schermata iniziale in corso...</p>
<form method=POST name=formaccesso action=welcome.php>
<input type=hidden name=nome value="<?php echo $nome ; ?>">
<input type=hidden name=tipo value="<?php echo $tipo ; ?>">
</form>
<script type=text/javascript>
js_home();
</script>
</body>



and this is the javascript file

//SCRIPTS UTILIZZATI

function js_2190_variati (){

form1.submit();
return false;
}

function js_check(x){
if (x.checked==true) document.form1.ok.disabled=false;
return true;
}

function controlla_radio() {
var q=document.queryform.query.value.substring(0,6).toUpperCase();
if (q=='SELECT') {
document.queryform.costrutto[1].checked=false;
document.queryform.costrutto[0].checked=true;
}
}
function js_sql(){
if (document.queryform.costrutto[0].checked==true) {
var q=document.queryform.query.value.substring(0,6).toUpperCase();
if (q=='SELECT') {
document.queryform.action="select.php";
document.queryform.submit();
return;
}
else {
alert("La query di interrogazione deve iniziare con la clausola SELECT");
return;
}
}
else {
var input=prompt("Inserire password del DBA per l'aggiornamento del
database","");
if(input!="submit") alert("Operazione annullata");
else document.queryform.submit();
}
}
function js_cancella(){
if (confirm("I Dati cancellati non saranno più ripristinabili - Procedere
con la cancellazione?")==true) document.form1.submit();
else {
alert("Cancellazione annullata");
history.back();
return false;
}
return false;
}
function js_modifica(){
document.form1.submit();
return false;
}

function js_home(){
if (document.formaccesso)
document.formaccesso.submit();
else location.href="welcome.php";
}

function js_valore(nomecampo){
var campo='document.form1.'+nomecampo+'.value';
alert(campo);
return campo;
}

function select_all(n){
for (i=1;i<=n;i++)
eval("document.form1.cassa"+i+".checked=true");
document.form1.ok.disabled=false;
}

function deselect_all(n){
for (i=1;i<=n;i++)
eval("document.form1.cassa"+i+".checked=false");
document.form1.ok.disabled=true;
}

function js_reparti(){
var vera='update reparti ';
var sel='select * from reparti ';
var q="set Descrizione=\'";
q=q+document.reparti.descr.value+'\' ';
q=q+' where ID_Reparto='+document.reparti.rep.value;
sel=sel+' where ID_Reparto='+document.reparti.rep.value;
vera=vera+q;
alert(vera+'\n'+sel);
document.reparti.updatequery.value=vera;
document.reparti.selectquery.value=sel;
document.reparti.submit();
}

function js_config(){
document.form1.action="sqlcommand.php";
var vera="update azienda set ";
vera=vera+"Ragione_Sociale=\'"+document.form1.ragsoc.value+"\' , ";
vera=vera+"Indirizzo=\'"+document.form1.indirizzo.value+"\' , ";
vera=vera+"Cap=\'"+document.form1.cap.value+"\' , ";
vera=vera+"Citta=\'"+document.form1.citta.value+"\' , ";
vera=vera+"Provincia=\'"+document.form1.prov.value+"\' , ";
vera=vera+"CF=\'"+document.form1.cf.value+"\' , ";
vera=vera+"PIVA=\'"+document.form1.piva.value+"\' , ";
vera=vera+"Tel=\'"+document.form1.tel.value+"\' , ";
vera=vera+"Fax=\'"+document.form1.fax.value+"\' , ";
vera=vera+"Anno=\'"+document.form1.anno.value+"\' ";
vera=vera+"where ID_Azienda= '1'";
alert(vera);
document.form1.query.value=vera;
document.form1.tabella.value="Configurazione";
document.form1.submit();
}

function aggiorna_prezzo(){
var prezzoal=document.getElementById("prezzoal");
var contenuto=document.form1.misura.value;
vecchio=prezzoal.firstChild;
vecchio.data='Prezzo al '+contenuto+' : ';
}

function creaquery2(){
var q='update articoli set giacenza=';
q=q+js_valore('quantita');
q=q+', prezzo=';
q=q+js_valore('prezzo');
q=q+' where indice=';
q=q+js_valore('articolo');
document.form1.updatequery.value=q;
document.write(""+document.form1.updatequery.value);
}
 
P

Pasquale

yes i saw your solution but i can't do it for every page-script couple in my
project...there are some scripts not activated after page loading...

but listen this...
i discovered something new...

if i access the site via lan from my home pc (the project is on the laptop)
it doesn't do any problems...

i think this is a matter with my NN and MSIE both...it's incredible...
oh gosh...i call this a big bad luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top