Le 25/03/12 09:29, naveen raj a écrit :
how to read from a file in the script ?
not possible
you must pass the text "to read" in a variable
then you can try to get the file
example
file to read : 'txt_1.js'
var t = 'Hello World';
reading :
<button onclick="newText('txt_1.js'); alert(t);">read 1</button>
function newText(url) {
var s = document.createElement('SCRIPT');
s.src = url;
document.body.appendChild(s);
}
not sure that works with IE