View Single Post
Old 03-16-2006, 02:54 AM   #1 (permalink)
j.gohel
Code Monkey
 
Join Date: Apr 2005
Posts: 68
j.gohel is on a distinguished road
A Jsp plus Javascript query

Hi,

I am having the following simple jsp page.:

Code:
    <HTML>
<HEAD>
<TITLE>Hyperlink Javascript Test </TITLE>
<script type = "text/javascript">
function testLink(val)
{	
	document.write(val);
}
</script>
</HEAD>
<BODY>
<form name = "test_link">
<table>	
	<%
		for(int k = 0; k < 5; k++)
		{
			String h_Nm = "hName"+k;
			String a_name = "nm"+k;
	%>
			<tr>
				<td>
					<input type = "button" name = "<%= h_Nm %>" value ="<%= a_name %>" onClick = "testLink(this.value)">					
				</td>
			<tr>
	<%
		}
	%>
</table>
</form>
</BODY>
</HTML>
O running this page i will get 5 buttons with their corresponding dynamic values . & on clicking the buttons i will get their respective values displayed.

But i want to do is i want a hyperlink instead of button with same label ,not different labels which i am getting at present which are the values i am getting dynamically, for each of the five hyperlinks but when i click on that hyperlink i should get the dynamic value i am providing at present for the button using javascript.

So please tell how to do this.

Thanks,
Jignesh
j.gohel is offline   Reply With Quote