haiii friends..

i want to generate buttons at the run time...and want to get the value on "onclick"...
The code is like this....


<html:button property="button1" onclick="getButton();" styleClass="FORM"><%=list.get(x)%></html:button>


x is incrementing...this code is inside a for loop......

thanksssssssss.....

is it java code ?????

its an html code....

try to put id element for each button but take care that id should be unique for each one.then using getElementById('id of button').onclick='funciton_name';
u can assign function to each button in java script

but i tried that...but there is some error...in this code...


<html:button property="button1" value="<%=list.get(x)%>" styleId="<%=list.get(x) %>"><%=list.get(x)%></html:button>

hw to set value field dynamically....

this is what i tried finally..

<INPUT TYPE=BUTTON id="+" onclick="getButton();" ><%=list.get(x)%>

and the script as

function getButton(){
var x=document.forms[0].getElementById();
alert(x);
}

but got no answer..pls help...

This is in the wrong forum. This has absolutely nothing to do with Java. JavaScript and Java are completely unrelated. Please post in a correct forum.

kkk...sorry for this...

and i solved the problem..any wayy thankzz a lot for ur help...

the problem is solvedd..thankzzzzzzzz:*

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.