J
john woo
Hi
I'm not good at JS, but want to get more about it.
I want to use a JSP (the java code just used to get date, the rest are
html and javascript),
to display a table. the requirement is the all rows in even number in
light-blue, rows in odd number in light gray, when a mouse clicks on a
row, this row gets highlighted and in yellow, and it keeps highlighted
until next row is clicked on; plus when a row gets click, the data on
the row is saved to forward to (same as putting vales in input form
then forward to action form).
part of my code is
int color=0;
<tr onmousedown="this.className='current';"
onmouseup="this.className='current'; saveRecord('<%=a%>',
'<%=b%>',
'<%=c%>');"
<%if (color%2==0){%>
onmouseout="this.className='even';" class="even"
<% } else { %>
onmouseout="this.className='odd ';" class="odd"
<td><%=e%></td>
<td>
...
function saverecord(...)
//<% %> is java code tag in jsp, used to get value
question
1.
result from above code, rows get highlighted when mouse moveing on it,
and can't keep highlighted for long (when mouse moves away,it is no
long in yellow).
2.
in saverecord function, what is the idea to put the valuables (a, b, c,
--they are global vars) in a hidden input form? or other way to
implement this?
I'm not good at JS, but want to get more about it.
I want to use a JSP (the java code just used to get date, the rest are
html and javascript),
to display a table. the requirement is the all rows in even number in
light-blue, rows in odd number in light gray, when a mouse clicks on a
row, this row gets highlighted and in yellow, and it keeps highlighted
until next row is clicked on; plus when a row gets click, the data on
the row is saved to forward to (same as putting vales in input form
then forward to action form).
part of my code is
int color=0;
<tr onmousedown="this.className='current';"
onmouseup="this.className='current'; saveRecord('<%=a%>',
'<%=b%>',
'<%=c%>');"
<%if (color%2==0){%>
onmouseout="this.className='even';" class="even"
<% } else { %>
onmouseout="this.className='odd ';" class="odd"
<td><%=e%></td>
<td>
...
function saverecord(...)
//<% %> is java code tag in jsp, used to get value
question
1.
result from above code, rows get highlighted when mouse moveing on it,
and can't keep highlighted for long (when mouse moves away,it is no
long in yellow).
2.
in saverecord function, what is the idea to put the valuables (a, b, c,
--they are global vars) in a hidden input form? or other way to
implement this?