unfortunally i don`t know a thing about javascript but i do want to have a small piece of javascript code..
you can see the exact piece i want to have in the mage below.

i also found 2 nice javascript pieces...
1: (_ from internet.com or some site like that _)
Code: Select all
<!-- TWO STEPS TO INSTALL ADDING HTML CONTROLS:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<script type="text/javascript">
<!-- Begin
/* This script and many more are available free online at
The JavaScript Source!! <a href="http://javascript.internet.com" target="_blank">http://javascript.internet.com</a>
Created by: Husay :: <a href="http://www.communitxt.net" target="_blank">http://www.communitxt.net</a> */
var arrInput = new Array(0);
var arrInputValue = new Array(0);
function addInput() {
//arrInput.push(createInput(arrInput.length));
arrInput.push(arrInput.length);
//arrInputValue.push(arrInputValue.length);
arrInputValue.push("");
display();
}
function display() {
document.getElementById('parah').innerHTML="";
for (intI=0;intI<arrInput.length;intI++) {
document.getElementById('parah').innerHTML+=createInput(arrInput[intI], arrInputValue[intI]);
}
}
function saveValue(intId,strValue) {
arrInputValue[intId]=strValue;
}
function createInput(id,value) {
return "<input type='text' id='test "+ id +"' onChange='java script:saveValue("+ id +",this.value)' value='"+ value +"'><a href='java script:deleteInput("+ id +")'>"+ id +"delete this field</a><br>";
}
function deleteInput(id) {
if (arrInput.length > 0) {
arrInput.pop();
arrInputValue[id];
}
display();
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<p id="parah">Dynamic creation of input boxes</p>
<a href="java script:addInput()">Add more input field(s)</a><br>
<a href="java script:deleteInput()">Remove field(s)</a>
<!-- Script Size: 1.74 KB -->Code: Select all
<html>
<head>
<script type="text/javascript">
fieldcount = 1;
function addUpload(){
var fieldvalues = new Array();
var i;
// de waarden van de bestaande velden opslaan
for(i = 1; i <= fieldcount; i++){
fieldvalues[i] = document.getElementById("file" + i).value;
}
// nieuw file field toevoegen
// PROBLEEM: bestaande velden worden leeggemaakt
fieldcount++;
document.getElementById("field_holder").innerHTML += "<input type='file' name='file" + fieldcount + "' id='file" + fieldcount + "' /><br />";
// de waarden instellen
for(i = 1; i <= fieldcount - 1; i++){
document.getElementById("file" + i).value = fieldvalues[i]; // <-- DIT WERKT NIET
// je kan van een file field om een of andere rede geen waarde instellen
// ik weet tot hiertoe geen oplossing daarvoor
}
}
</script>
<body>
<form method="post" name="uploadform" action="js_form_read.php" enctype="multipart/form-data">
<div id="field_holder">
<input type="file" name="file1" id="file1" /><br />
</div>
<a href="#" onClick="addUpload();">Nog een bestand uploaden</a><br /><br />
<input type="submit" value="Verzenden" />
</form>
</body>
</head>
</html>There are still serveral bad things in script 2
- when you add a new field the value of the existing fields will be gone
- you can`t delete a filed like you can in google...
So i was hoping that someone could help me out with this script