Solved HTML Coding

marthijn99

New member
Local time
3:35 PM
Messages
50
Location
Rijssen
HI when i try to save a file i made in the html web page it only saves the first <textarea> thing and not the the remaining here is the code i use :


<html>
<body>

<table>
<tr><td>Text to Save:</td></tr>
<tr>
<td colspan="3">
<p>Geld Over Gehouden ?</p>
<textarea id="inputTextToSave" style="width:300px;height:22px"></textarea><br>
<p>Over Gehouden Bedrag Gekregen Van begeleiding:</p>
<textarea id="inputTextToSave" style="width:300px;height:22px"></textarea><br>
<p>Bedrag Gepind Van Rekening (Voor Je Zelf Dus Geen Recreatie Geld !): </p>
<textarea id="inputTextToSave" style="width:300px;height:22px"></textarea><br>
<p>Wat Heb Ik Over Gehouden/Is Er Afgegaan ?</p>
<textarea id="inputTextToSave" style="width:300px;height:22px"></textarea><br>
<p>Uitgegeven bedrag:</p>
<textarea id="inputTextToSave" style="width:300px;height:22px"></textarea><br>
<p>Totaal Bedrag:</p>
<textarea id="inputTextToSave" style="width:300px;height:22px"></textarea><br>
<p>Wat Heb Ik Allemaal Gekocht (Onderscheiden Met Een *. En Aangeven Wat Het Heeft Gekost!):</p>
<textarea id="inputTextToSave" style="width:300px;height:150px"></textarea><br>
</td>
</tr>
<tr>
<td>Filename to Save As:</td>
<td><input id="inputFileNameToSaveAs"></input></td>
<td><button onClick="saveTextAsFile()">Save Text to File</button></td>
</tr>
</table>

<script type='text/javascript'>

function saveTextAsFile()
{
var textToWrite = document.getElementById("inputTextToSave").value;
var textFileAsBlob = new Blob([textToWrite], {type:'text/plain'});
var fileNameToSaveAs = document.getElementById("inputFileNameToSaveAs").value;

var downloadLink = document.createElement("a");
downloadLink.download = fileNameToSaveAs;
downloadLink.innerHTML = "Download File";
if (window.webkitURL != null)
{
// Chrome allows the link to be clicked
// without actually adding it to the DOM.
downloadLink.href = window.webkitURL.createObjectURL(textFileAsBlob);
}
else
{
// Firefox requires the link to be added to the DOM
// before it can be clicked.
downloadLink.href = window.URL.createObjectURL(textFileAsBlob);
downloadLink.onclick = destroyClickedElement;
downloadLink.style.display = "none";
document.body.appendChild(downloadLink);
}

downloadLink.click();
}

function destroyClickedElement(event)
{
document.body.removeChild(event.target);
}

function loadFileAsText()
{
var fileToLoad = document.getElementById("fileToLoad").files[0];

var fileReader = new FileReader();
fileReader.onload = function(fileLoadedEvent)
{
var textFromFileLoaded = fileLoadedEvent.target.result;
document.getElementById("inputTextToSave").value = textFromFileLoaded;
};
fileReader.readAsText(fileToLoad, "UTF-8");
}

</script>

</body>
</html>
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
unknown
OS
Windows 8.1 x64
CPU
Intel(R) Core(TM) I3-3220 3.30GHZ
Motherboard
unknown
Memory
4 gb ram
Graphics Card(s)
AMD Radeon 6570
Screen Resolution
1280 x1024
Hard Drives
500 gb
Keyboard
Logitec k120
Mouse
MaxXrer
Internet Speed
30 MB p/s
Antivirus
avira,avg (both free)
Browser
google chrome
save a file i made in the html web page
What editor are you using? I can't see anything wrong with the code except perhaps the lack of a <form> but I don't think that's necessary. So try another editor or simply Notepad. It's probably a problem with the editor you're using.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Elitebook 8540p
OS
Windows 7 Pro 32
CPU
Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz
Motherboard
Hewlett-Packard 1521
Memory
4,00 GB (Usable 2,98)
Graphics Card(s)
NVIDIA NVS 5100M
Sound Card
NVIDIA High Definition Audio
Screen Resolution
1600x900
Hard Drives
INTEL SSDSA2CW120G3
Antivirus
F-Secure Internet Security
Browser
IE, Firefox, Opera
Other Info
Sandboxie,
SRP (Software Restriction Policy),
EMET (Enhanced Mitigation Experience Toolkit),
WFC (Windows Firewall Control by BiniSoft),
Malwarebytes Premium
save a file i made in the html web page
What editor are you using? I can't see anything wrong with the code except perhaps the lack of a <form> but I don't think that's necessary. So try another editor or simply Notepad. It's probably a problem with the editor you're using.


okay will try that
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
unknown
OS
Windows 8.1 x64
CPU
Intel(R) Core(TM) I3-3220 3.30GHZ
Motherboard
unknown
Memory
4 gb ram
Graphics Card(s)
AMD Radeon 6570
Screen Resolution
1280 x1024
Hard Drives
500 gb
Keyboard
Logitec k120
Mouse
MaxXrer
Internet Speed
30 MB p/s
Antivirus
avira,avg (both free)
Browser
google chrome
save a file i made in the html web page
What editor are you using? I can't see anything wrong with the code except perhaps the lack of a <form> but I don't think that's necessary. So try another editor or simply Notepad. It's probably a problem with the editor you're using.

yes i tryed that what you d say but the problem is that the file it must create with the info i filled in does not save only the first line in the form PS: see the screen shot to the left is the web page with the filled in info an to the right is the outcome of the form saved in a file as it must do in the form

kindly regards marthijn99 aka marthijnwennemers
 

Attachments

  • Naamloos.png
    Naamloos.png
    71.8 KB · Views: 1

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
unknown
OS
Windows 8.1 x64
CPU
Intel(R) Core(TM) I3-3220 3.30GHZ
Motherboard
unknown
Memory
4 gb ram
Graphics Card(s)
AMD Radeon 6570
Screen Resolution
1280 x1024
Hard Drives
500 gb
Keyboard
Logitec k120
Mouse
MaxXrer
Internet Speed
30 MB p/s
Antivirus
avira,avg (both free)
Browser
google chrome
Ok. I misunderstood you before. That is probably because you have the same id value for all textareas, so only the first one will be handled properly.

<textarea id="inputTextToSave"

Change the id's to inputTextToSave1, inputTextToSave2 etc.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Elitebook 8540p
OS
Windows 7 Pro 32
CPU
Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz
Motherboard
Hewlett-Packard 1521
Memory
4,00 GB (Usable 2,98)
Graphics Card(s)
NVIDIA NVS 5100M
Sound Card
NVIDIA High Definition Audio
Screen Resolution
1600x900
Hard Drives
INTEL SSDSA2CW120G3
Antivirus
F-Secure Internet Security
Browser
IE, Firefox, Opera
Other Info
Sandboxie,
SRP (Software Restriction Policy),
EMET (Enhanced Mitigation Experience Toolkit),
WFC (Windows Firewall Control by BiniSoft),
Malwarebytes Premium
Ok. I misunderstood you before. That is probably because you have the same id value for all textareas, so only the first one will be handled properly.

<textarea id="inputTextToSave"

Change the id's to inputTextToSave1, inputTextToSave2 etc.


okay that should work but for the one or another reason i cant save it file as txt any more
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
unknown
OS
Windows 8.1 x64
CPU
Intel(R) Core(TM) I3-3220 3.30GHZ
Motherboard
unknown
Memory
4 gb ram
Graphics Card(s)
AMD Radeon 6570
Screen Resolution
1280 x1024
Hard Drives
500 gb
Keyboard
Logitec k120
Mouse
MaxXrer
Internet Speed
30 MB p/s
Antivirus
avira,avg (both free)
Browser
google chrome
Sorry, don't know about that. Maybe something to do with the Blob object but that's just a guess....
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Elitebook 8540p
OS
Windows 7 Pro 32
CPU
Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz
Motherboard
Hewlett-Packard 1521
Memory
4,00 GB (Usable 2,98)
Graphics Card(s)
NVIDIA NVS 5100M
Sound Card
NVIDIA High Definition Audio
Screen Resolution
1600x900
Hard Drives
INTEL SSDSA2CW120G3
Antivirus
F-Secure Internet Security
Browser
IE, Firefox, Opera
Other Info
Sandboxie,
SRP (Software Restriction Policy),
EMET (Enhanced Mitigation Experience Toolkit),
WFC (Windows Firewall Control by BiniSoft),
Malwarebytes Premium
Sorry, don't know about that. Maybe something to do with the Blob object but that's just a guess....

okay so ...... you dont know a fix ? and the blob object how do i fix that ?
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
unknown
OS
Windows 8.1 x64
CPU
Intel(R) Core(TM) I3-3220 3.30GHZ
Motherboard
unknown
Memory
4 gb ram
Graphics Card(s)
AMD Radeon 6570
Screen Resolution
1280 x1024
Hard Drives
500 gb
Keyboard
Logitec k120
Mouse
MaxXrer
Internet Speed
30 MB p/s
Antivirus
avira,avg (both free)
Browser
google chrome
tread clossed since i cant find anny new info of waiting
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
unknown
OS
Windows 8.1 x64
CPU
Intel(R) Core(TM) I3-3220 3.30GHZ
Motherboard
unknown
Memory
4 gb ram
Graphics Card(s)
AMD Radeon 6570
Screen Resolution
1280 x1024
Hard Drives
500 gb
Keyboard
Logitec k120
Mouse
MaxXrer
Internet Speed
30 MB p/s
Antivirus
avira,avg (both free)
Browser
google chrome
Thanks every one for the help
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
unknown
OS
Windows 8.1 x64
CPU
Intel(R) Core(TM) I3-3220 3.30GHZ
Motherboard
unknown
Memory
4 gb ram
Graphics Card(s)
AMD Radeon 6570
Screen Resolution
1280 x1024
Hard Drives
500 gb
Keyboard
Logitec k120
Mouse
MaxXrer
Internet Speed
30 MB p/s
Antivirus
avira,avg (both free)
Browser
google chrome
Back
Top