Environment:
under rails For example:
After I click to modify it, it looks like this:
Key implementation process :
1. The list part, that is, the first picture, the blue part realizes value passing
<% i=0 %>
<% if @group_page %>
<% for group in @group_page %>
< ;% i =1 %>
>
<%= group.id.to_s %> |
<%= group.group_name==nil ? '': group.group_name.to_s %> |
<%= group.display_order==nil ? '': group.display_order.to_s %> |
<%= group.update_dt.strftime("%Y-%m-%d") %> |
<%= group.status.to_s == '0' ? 'Normal' : "disable" %> |
<%= group.group_comment==nil ? '': group.group_comment.to_s %> |
< ;td><%= link_to image_tag('/images/cs/edit-icon.gif'),{},{:onclick =>"show_div('" group.id.to_s "','" group. group_name.to_s "','" group.display_order.to_s "','" group.status.to_s "','" group.group_comment.to_s "');return false;" } %>
<%= link_to image_tag('/images/cs/hr.gif'),{:action=>'deletegroup',:id=>group.id.to_s},{: confirm=>'Are you sure you want to delete?'} %> |
<% end %>
<% end %>
2, js function part
<script> <br>function show_div(object1,object2,object3,object4,object5) <br>{ <br>document.getElementById("original_group").style.display = "none"; <br>document.getElementById ("modify_group").style.display=""; <br>document.getElementById("group_id").value =object1; <br>document.getElementById("modify_name").value =object2; <br>document. getElementById("modify_order").value =object3; <br>if ( object4 == "0"){ <br>document.getElementById('modify_status').selectedIndex=0; <br>} <br>if( object4 == "1"){ <br>document.getElementById('modify_status').selectedIndex=1; <br>} <br>document.getElementById("modify_comment").value =object5; <br>} <br> </script>
In this way, you can realize the client using js to pass values.............
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn