473,405 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

JS external file loaded in bad way

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?
Jul 23 '05 #1
10 1894
"Pasquale" <we*******@retailcenter.it> wrote in message
news:LE**********************@news4.tin.it...
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!
Jul 23 '05 #2
Pasquale wrote:
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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #3
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

"Pasquale" <we*******@retailcenter.it> ha scritto nel messaggio
news:LE**********************@news4.tin.it...
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?

Jul 23 '05 #4
Pasquale wrote:
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.
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

"Pasquale" <we*******@retailcenter.it> ha scritto nel messaggio
news:LE**********************@news4.tin.it...
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?


Jul 23 '05 #5
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).to UpperCase();
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).to UpperCase();
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.rags oc.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 );
}

"Brett Foster" <fo****************@ioctl.ca> ha scritto nel messaggio
news:33*************@individual.net...
Pasquale wrote:
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.

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

"Pasquale" <we*******@retailcenter.it> ha scritto nel messaggio
news:LE**********************@news4.tin.it...
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?



Jul 23 '05 #6
i see the attached files are not accessible...so if you cant' access them, i
can send them to everyone wants to help me via e-mail.

thanks a lot

"Pasquale" <we*******@retailcenter.it> ha scritto nel messaggio
news:7%**********************@news4.tin.it...
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

"Pasquale" <we*******@retailcenter.it> ha scritto nel messaggio
news:LE**********************@news4.tin.it...
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?


Jul 23 '05 #7
Pasquale wrote:
<snip>

I'd move the function call into the .js file and call it from
window.onload. It may be that the browser is trying to call the function
before the .js file has fully loaded. The window.onload is not executed
until after the browser has completely loaded the page.

window.onload=js_home';

"The load event is fired at the end of the document loading process."

http://www.mozilla.org/docs/dom/domr...dow_ref63.html

Mike
Jul 23 '05 #8
mscir wrote:

Sorry, that should be:

window.onload=js_home;

Mike
Jul 23 '05 #9
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!
Jul 23 '05 #10
Pasquale wrote:
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!


- Did moving the function call into window.onload in the .js file (on
the single page you did post code for) fix that particular problem in
all browsers?

- Only use this approach where you call a function directly from a page.
I don't understand your concern about 'some scripts not activated after
page loading'. If a function is called from a button click of course you
wouldn't want it called from window.onload, maybe I'm not following you.
It would be clearer if you would post specific problems and include more
details.

Mike
Jul 23 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Charley Kyd | last post by:
I'm a newbie who needs advice about how to use external files of JavaScript code. I spent an hour this afternoon browsing through JavaScript books at the local book store. In about 15 different...
1
by: Tim Fooy | last post by:
Hi all, When i load my page, an external .js file gets loaded with it. Then when a user clicks on any of 10 different images, a different .js file should be loaded. Those files are quite large...
5
by: joaopedrogoncalves | last post by:
Hi, I want to load an external javascript file, get its results and stick them inside a <div> block. I also want to do this in several places on a web page. This way the browser doesn't have...
4
by: primary0 | last post by:
Hi, I have a page containing an external javascript which loads an image onto the webpage. How would it be possible to use javascript to read the filname (and the dimensions) of the loaded image...
3
by: Trapulo | last post by:
I've a datarepeater that loads custom external templates with loadtemplate and bind data to them. All ok. Now I need to localize some text labels, but I don't know how can I change this data. If I...
17
by: CES | last post by:
All, I was wondering if their is a way of loading an external script fill from within a script?? <script language="javascript" type="text/javascript"> function test(var){ <script...
1
by: ozzy.osborn | last post by:
Hello All, I have been struggling with a cross browser solution to loading external javascript files on the fly. I have been successful using the following code in IE6: var newScr =...
4
by: fmaxwell | last post by:
Dear Group I have a very frustrating problem. I have been trying to make it more difficult to access external javascript files by using PHP sessions. This works beautifully locally (both in...
20
by: Mark Anderson | last post by:
Hi, I have this in an external JS library: ///////////////////////// function addMyEvent(){ var obj; if(document.attachEvent) { obj = document.getElementsByTagName('img'); for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.