js顺序

来源:互联网 发布:好的莆田鞋淘宝店 编辑:程序博客网 时间:2024/06/16 06:21

<scripttype="text/javascript">

       $(function () {

           var html = "<input type='text' id='inputReason'style='width:280px; height:100px; resize: none;border:none;margin:5px'/>";

var value=$("#inputReason").val();

           $("#btnRebut").click(function () {

//               jBox.open("iframe:http://www.baidu.com", "百度一下",800, 350);

//                jBox.open(html, '驳回原因', 300,200);

                $.jBox(html, {

                    title: "驳回原因",

                    width: 300,

                    height: 200,

                    buttons: {"提交":'ok', "取消": 'cancel'},

                    buttonsFocus: 'ok',

                    submit: function (v, h, f){

                        if (v =="ok") {

                            console.log(value);

//                            name = f.name;

//                            phone = f.phone;

//                            address =f.address;

//                            desc = f.desc;

                            $.post(url, /*{

                            "jBox.name": name,

                            "jBox.phone": phone,

                            "jBox.address": address,

                            "jBox.desc": desc

                             }, */function(data, status) {

                                if("success" == status) {

                                   $.jBox.success("Data Transufal success!","success");

                                   parent.location.reload();

                                } else {

                                   $.jBox.error("Error Transufal", "Error");

                                    returnfalse;

                                }

                            });

                        }

                        if (v == "cancel"){

                            alert("已取消!");

                            return true;

                        }

                    }

                });

           });

       });

   </script>




<scripttype="text/javascript">

       $(function () {

           var html = "<input type='text' id='inputReason'style='width:280px; height:100px; resize: none;border:none;margin:5px'/>";

           $("#btnRebut").click(function () {

//               jBox.open("iframe:http://www.baidu.com", "百度一下",800, 350);

//                jBox.open(html, '驳回原因', 300,200);

                $.jBox(html, {

                    title: "驳回原因",

                    width: 300,

                    height: 200,

                    buttons: {"提交":'ok', "取消": 'cancel'},

                    buttonsFocus: 'ok',

                    submit: function (v, h, f){

                        var value=$("#inputReason").val();

                        if (v =="ok") {

                            console.log(value);

//                            name = f.name;

//                            phone = f.phone;

//                            address =f.address;

//                            desc = f.desc;

                            $.post(url, /*{

                            "jBox.name": name,

                            "jBox.phone": phone,

                            "jBox.address": address,

                            "jBox.desc": desc

                             }, */function(data, status) {

                                if("success" == status) {

                                   $.jBox.success("Data Transufal success!","success");

                                   parent.location.reload();

                                } else {

                                   $.jBox.error("Error Transufal", "Error");

                                    returnfalse;

                                }

                            });

                        }

                        if (v == "cancel"){

                            alert("已取消!");

                            return true;

                        }

                    }

                });

           });

       });

   </script>



标红的两句代码的位置不同导致输出的结果不同,记录一下,要注意顺序!!!!