You need to click an image to publish the set. The page code is as follows:
Html code
-
- <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 group is released, you need to change the method for calling the next click event.
Use: img. click (function () {changeToOpen (suitId, img );});
Result: The method defined by the onclick event defined by img is executed first, then the method bound by the previous onclick is executed, and finally the binding method is executed.
Find the unbind code: unbind ('click ')
Img. unbind ('click'). click (function () {changeToOpen (suitId, img );});
Result: The onclick event definition method defined by img is executed first, and then the binding method is executed.
Find the code for unbinding onclick:
Img. attr ('onclick', ''). unbind ('click'). click (function () {changeToOpen (suitId, img );});
Js Code
- Function changeToOpen (suitId, img ){
- // Use train_com ac_type to transmit 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 ){
- // PilotInfForVoteDto is used to transmit the 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 );});
- }
- });
- }