hello all,
i created a script that creates a list of tables…it is working in firefox and chrome but in i.e doesnt works can anyone tell me why the script is the above…
[code=php]
<script type=”text/javascript”>
window.onload = createform_friend();
//function to create the form
function createform_friend(){
ul_friend = cE(‘ul’, {
id: “ul_friend”
});
}
//function to create the main fields
function addfield_friend(type){
//get the ingredListDiv element and theValue_friend
var parent = document.getElementById(‘friendListDiv’);
var numEle = document.getElementById(‘theValue_friend’);
var num = numEle.value = parseInt(numEle.value, 10)+1;
var tempo=num-1;
//constract a list item
switch(type){
case ‘friend’:
var li = cE(‘li’, {
id: “friend_”+num,
class: “friend-sendlist”
});
break;
}
//constract spanTag
spanTag = document.createElement(“span”);
//constract table
var table = cE(‘table’, {
border : 1,
width : 620
});
//constract two rows in the table
var firstrow = table.insertRow(0);
//CREATE FIRST ROW
//create FirstRow_cell_1
var cell_1 = firstrow.insertCell(0);
cell_1.appendChild(document.createTextNode(‘Όνομα αποστολέα:’));
cell_1.setAttribute(“style”,”padding:2px 0px 4px 6px;”);
cell_1.width = 200;
var div = document.createElement(‘div’);
div.setAttribute(“class”,”friend-text”);
var span = document.createElement(‘span’);
span.appendChild(
cE(‘input’, {
id: “fname”+num,
type: “text”,
name: “fname”+tempo+””,
}));
div.appendChild(span);
cell_1.appendChild(div);
cell_1.appendChild(
cE(‘input’, {
type: “hidden”,
name: “Type[“+tempo+”]”,
value: “text”,
}));
//appending all list objects
spanTag.appendChild(table);
li.appendChild(spanTag);
ul_friend.appendChild(li);
parent.appendChild(ul_friend);
}
//function to create element and assigning attributes
function cE(ele, attributes){
var el = document.createElement(arguments[0]);
if(attributes){
for( var x in attributes ){
el.setAttribute(x, attributes[x]);
}
}
return el;
}
//function to attach event
function AttachEvent(obj,evt,fnc){
if(obj.addEventListener){
obj.addEventListener(evt,fnc,false);
return true;
}
if(obj.attachEvent)
return obj.attachEvent(“on”+evt, fnc);
obj[‘on’+evt] = fnc;// not a perfect solution, still.
}
</script>
and call it from html:
[code=php]
<div id=”friendListDiv”></div>
<div id=”hiddenDiv_friend”></div>
<a class=”redbutton” style=”float:left;margin:20px 0 0 10px;” href=”javascript:addfield_friend(‘friend’)”><span>Προσθήκη</span></a>
please help very important for mee…