0

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.....

3
Contributors
8
Replies
9
Views
9 Years
Discussion Span
Last Post by ajithraj
0

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

0

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....

0

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...

0

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.

0

kkk...sorry for this...

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.