...

View Full Version : help me please?



akg250978
07-04-2006, 12:19 PM
i am having trouble with my script here is the script 1st

Selection[0].setAttribute("onchange", 'DropDownMenuList("addDocuments2")');

now the problem is where u see the "dropdown menu" it is a js function so when this element is create and inserted in the form it should be able to call on this fuction , i don't know the problem, may be the qoutes is wrong or i have set the attributes wrong

some 1 please help me :thumbsup:

_Aerospace_Eng_
07-04-2006, 12:22 PM
Try this, the camelCase. IE needs this for it to work properly.

Selection[0].setAttribute("onChange", "DropDownMenuList('addDocuments2')");
If that doesn't work then you need to post the rest of your code.

akg250978
07-04-2006, 12:30 PM
thanks for the help i tried that but it still does not do what i want here is the full code
function addLine()
{
var Documents = new Array(5)
Documents[0]="Invoice";
Documents[1]="Bill";
Documents[2]="Packing List";
Documents[3]="Policy";
Documents[4]="Other";

var Values = document.getElementById('Value1');
Values.value = (document.getElementById("Value1").value -1)+ 2;

var TRIdName = "Create"+ Values +"TR";

var tbody = document.getElementById("table1").getElementsByTagName("tbody")[0];
var row = document.createElement("TR");
row.setAttribute("id",TRIdName);

var Cells = new Array(3)
var Selection = new Array(3)

var Options = new Array(3)
var Inputs = new Array(1)

for (var a=0; a < Cells.length; a++)
{
Cells[a]= document.createElement("TD");
Selection[a]= document.createElement("select");
Selection[a].className = 'Text';

if(a==0)
{
Selection[0].setAttribute("id","addDocuments2");
Selection[0].setAttribute("onchange", 'DropDownMenuList("addDocuments2")');

for (var b=0; b < Documents.length; b++)
{
Options[0]=document.createElement("option");
theText=document.createTextNode(Documents[b]);

Options[0].appendChild(theText);
Selection[0].appendChild(Options[0]);
}
}
else
{
for (var b=0; b < 10; b++)
{
Options[a]=document.createElement("option");
theText=document.createTextNode(b);

Options[a].appendChild(theText);
Selection[a].appendChild(Options[a]);
}
}

}

Inputs[0]= document.createElement("input");
Inputs[0].setAttribute("id","InputaddDocuments2");
Inputs[0].setAttribute("name","addDocuments2");
Inputs[0].setAttribute("type","text");



for (var c=0; c < Cells.length ; c++)
{
Cells[c].appendChild(Selection[c]);
if(c==0)
{
Cells[c].appendChild(Inputs[0])
}
row.appendChild(Cells[c]);
}
tbody.appendChild(row);
}


see what it ment to happen is u get a selection and when u chose the selection it would appear in the input field, now it all comes up but when making the selection it does not appear in the input field

and thank you for replying

sorry if you get a head ache from this

_Aerospace_Eng_
07-04-2006, 12:34 PM
Okay you might have to use the DOM1 method.

Selection[0].onchange = function()
{
DropDownMenuList('addDocuments2');
}

akg250978
07-04-2006, 12:45 PM
dude u r the man, it works, it's alive, hey do i click to nominate link, or do you have the award already cause

akg250978
07-04-2006, 12:50 PM
just 1 more thing in the same codes how can i create this in the elements

<xsl:attribute name="value">
<xsl:value-of select="e/fields/Docs"/>
</xsl:attribute>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum