Load file into javascript variable
I like your site and the activewidgets grid. I am not using it yet. I am just beginning to educate myself about XMLHTTP and the Sarissa Library.
I want to share this piece of code I wrote that you may be able to use and promote to your visitors. I wrote it because I found various place on the net that said it is not possible to read a file and load the content into a variable. I got around the issue by reading the content of a particular div into a variable in the file that is being read.
Save the following code into a file:
<html>
<head>
<title>Untitled</title>
<script language="JavaScript">
function loadFile() {
var divHandle = document.getElementById("mydiv");
var saveText = divHandle.innerHTML;
divHandle.innerHTML = 'Transform the contents: <font color:green>'+saveText+'</font>';
alert("contents:"+saveText);
}
</script>
</head>
<body onLoad="loadFile()">
<div id="mydiv">
Line 1
Line 2
Line 3
</div>
</body>
</html>
Now in your browser open the file.
Once you have the contents in a variable you can use to replace the contents of the original or even call the variable from another frame.
My website is fixmywebsite.net
I want to share this piece of code I wrote that you may be able to use and promote to your visitors. I wrote it because I found various place on the net that said it is not possible to read a file and load the content into a variable. I got around the issue by reading the content of a particular div into a variable in the file that is being read.
Save the following code into a file:
<html>
<head>
<title>Untitled</title>
<script language="JavaScript">
function loadFile() {
var divHandle = document.getElementById("mydiv");
var saveText = divHandle.innerHTML;
divHandle.innerHTML = 'Transform the contents: <font color:green>'+saveText+'</font>';
alert("contents:"+saveText);
}
</script>
</head>
<body onLoad="loadFile()">
<div id="mydiv">
Line 1
Line 2
Line 3
</div>
</body>
</html>
Now in your browser open the file.
Once you have the contents in a variable you can use to replace the contents of the original or even call the variable from another frame.
My website is fixmywebsite.net
Fidel Guajardo
July 20,