Forums Register Login

urgent help please

+Pie Number of slices to send: Send
There is a text box say
<input type = "class" value = ""> on the value part i want to display say a random value from one of these mentioned below
CLIENT
BUS
TRAIN
FlIGHT
SHIP
How can i do this ,any snippet will be of great help
+Pie Number of slices to send: Send
<%
String[] values = {"value1", "value2", value3"};
Random random = new Random();
int randomValue = random.nextInt(values.length);
%>
<input type="text" value="<%=values[randomValue] %>">
NOTES: You'll have to check that the random number generator doesn't generate values outside of the index values - I haven't tested this piece of code.
Then just insert your values in the String Array instead of value1, value2 etc.
+Pie Number of slices to send: Send
Thanksssssss a lot Timler , i was fighting with a bigger code but ur snippet was very snappy and cool, thanks once again for ur help
I'm THIS CLOSE to ruling the world! Right after reading this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1006 times.
Similar Threads
Custom Validators
Java Script to java
How to replace data in a file
Passing Object from A.jsp page to B.jsp page in another context
flipping bytes
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 01:32:00.