Need to click on the image to publish the set of groups, page code:
HTML code
- < img width="20px" src= "
- < S:property Value="Images_path" /><s:if Test='%{ Releasestatus = = "YES"} '>pubed.png</s:if>
- < S:else >nopub.png</s:else>"
- onclick= "<s:if test= '%{releasestatus = =" YES "} '>changetoclose (< s:property value= "suiteid" />, $ (this)); </ s:if >
- < S:else >changetoopen (<s:property value="Suiteid" / >, $ (this)); </ S:else >" />
After the set is released, you need to change the method of the next click event Invocation.
Used: Img.click (function () {Changetoopen (Suitid, IMG);});
Result: Executes the method defined by the OnClick event defined by IMG, then executes the method previously bound by the onclick, and finally executes the method of this binding.
Find unbound code: Unbind (' click ')
Img.unbind (' click '). Click (function () {Changetoopen (Suitid, IMG);});
Result: The method defined by the OnClick event defined by IMG is executed first, and then the method of this binding is executed.
Find the code to dismiss the onclick binding:
Img.attr (' onclick ', '). Unbind (' click '). Click (function () {Changetoopen (Suitid, IMG);});
JS Code
- function changetoopen (Suitid, img) {
- //Use train_com Ac_type to implement the pass lock information
- params = "train_com="+suitid+ "&ac_type=yes"; //alert (params);
- $.post ("dosimulatorpubbyid.do", params,function(data) {
- Eval ("var rst ="+data);
- alert (rst.msg);
- if (Rst.status = = 3) {
- Img.attr ("src","<s:property value="images_path"/>pubed.png");
- Img.attr ('onclick ', '). Unbind (' click '). Click ( function () {Changetoclose ( Suitid, IMG); });
- }
- });
- }
- function changetoclose (Suitid, img) {
- //Here with the help of pilotinfforvotedto to achieve the transmission lock information
- params = "train_com="+suitid+ "&ac_type=no"; //alert (params);
- $.post ("dosimulatorpubbyid.do", params,function(data) {
- Eval ("var rst ="+data);
- alert (rst.msg);
- if (Rst.status = = 3) {
- Img.attr ("src","<s:property value="images_path"/>nopub.png");
- Img.attr ('onclick ', '). Unbind (' click '). Click ( function () {Changetoopen ( Suitid, IMG); });
- }
- });
- }