小编and*_*lzo的帖子

"void 0"和"undefined"之间的区别

我正在使用"Closure Compiler",在编译脚本时我会花费以下内容:

编译之前:

// ==ClosureCompiler==
// @compilation_level SIMPLE_OPTIMIZATIONS
// @output_file_name default.js
// @formatting pretty_print,print_input_delimiter
// ==/ClosureCompiler==

var myObj1 = (function() {

  var undefined;   //<----- declare undefined

  this.test = function(value, arg1) {

    var exp = 0;
    arg1 = arg1 == undefined ? true : arg1;  //<----- use declare undefined
    exp = (arg1) ? value * 5 :  value * 10;

    return exp;
  };

  return this;
}).call({});

var myObj2 = (function() {

  this.test = function(value, arg1) {

    var exp = …
Run Code Online (Sandbox Code Playgroud)

javascript google-closure google-closure-compiler

59
推荐指数
4
解决办法
2万
查看次数

ASP.NET MVC 2 - 使用jquery ajax响应失败

我不明白这个错误,不要在"JsonResult Test()"中生成错误,我正在做其他项目作为ASP.NET MVC

谢谢

错误:

System.InvalidOperationException: This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet.

[InvalidOperationException: This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet.]
   System.Web.Mvc.JsonResult.ExecuteResult(ControllerContext context) +263733
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +10
   System.Web.Mvc.<>c__DisplayClass14.<InvokeActionResultWithFilters>b__11() …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc jquery json

38
推荐指数
1
解决办法
2万
查看次数

使用AngularJS的ASP.NET MVC验证表单

我正在使用MVC 4和AngularJS(+ twitter bootstrap)中的项目.我通常在我的MVC项目中使用"jQuery.Validate","DataAnnotations"和"Razor".然后我在web.config中启用这些键以验证客户端上模型的属性:

<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
Run Code Online (Sandbox Code Playgroud)

例如,如果我在我的模型中有这个:

[Required]
[Display(Name = "Your name")]
public string Name { get; set; }
Run Code Online (Sandbox Code Playgroud)

有了这个Cshtml:

@Html.LabelFor(model => model.Name)
@Html.TextBoxFor(model => model.Name)
@Html.ValidationMessageFor(model => model.Name)
Run Code Online (Sandbox Code Playgroud)

html结果将:

<label for="Name">Your name</label>
<input data-val="true" data-val-required="The field Your name is required." id="Name" name="Name" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="Name" data-valmsg-replace="true"></span>
Run Code Online (Sandbox Code Playgroud)

但是现在当我使用AngularJS时,我想渲染可能是这样的:

<label for="Name">Your name</label>
<input type="text" ng-model="Name" id="Name" name="Name" required />
<div ng-show="form.Name.$invalid">
   <span ng-show="form.Name.$error.required">The field Your name is required</span>
</div>
Run Code Online (Sandbox Code Playgroud)

我不知道是否有任何助手或"数据注释"来解决这个问题.我知道AngularJS还有很多其他功能:

<div ng-show="form.uEmail.$dirty …
Run Code Online (Sandbox Code Playgroud)

validation asp.net-mvc data-annotations razor angularjs

36
推荐指数
2
解决办法
3万
查看次数

ASP.NET虚拟路径在哪里解析波形符"〜"?

例如,ASP.NET虚拟路径在哪里解析~链接中 的波浪号

<link rel="stylesheet" type="text/css" href="~/Css/Site.css" />
Run Code Online (Sandbox Code Playgroud)

它重定向,还是RedirectToAction在ASP.NET MVC中?

asp.net

13
推荐指数
1
解决办法
1万
查看次数

在控制器中创建子文件夹

如何在ASP.NET MVC 1中执行子文件夹.例如,在控制器上采用以下文件夹结构:

/Controller
  /Blog
     ViewsController.cs
     ArticlesController.cs
  /Customers
     SalesController.cs
     ProductsController.cs
  HomeController.cs
Run Code Online (Sandbox Code Playgroud)

我想在视图中有以下文件夹结构,每个视图找到你的控制器:

/Views
  /Blog
     /Views
        Index.aspx
        Admin.aspx
        Show.aspx
     /Articles
        Show.aspx
        Admin.aspx
  /Customers
     /Sales
        Index.aspx
        Totals.aspx
     /Products
        Index.aspx
        Promotions.aspx
  /Home
     Index.aspx
Run Code Online (Sandbox Code Playgroud)

.net asp.net-mvc

10
推荐指数
2
解决办法
1万
查看次数

jQuery.sortable.通过JavaScript更改顺序

如何在JavaScript应用后更改列表的顺序jQuery.sortable.

例如:

<ul id="mylist">
  <li>1</li>
  <li>2</li>
  <li>3</li>
  <li>4</li>
  <li>5</li>
</ul>
Run Code Online (Sandbox Code Playgroud)

var x_sortable_list = $("mylist").sortable();
Run Code Online (Sandbox Code Playgroud)

然后,假设这个工作:

x_sortable_list.changeOrder([
 {item:1, newOrder:2 },
 {item:2, newOrder:1 },
 {item:3, newOrder:3 }
]);
Run Code Online (Sandbox Code Playgroud)

html sorting jquery html-lists

10
推荐指数
2
解决办法
1万
查看次数

我什么时候应该使用语法"(function(){...})();"?

我的查询用于"(function(){...})();" 鉴于我不是插件.例如" http://piecesofrakesh.blogspot.com/2009/03/downloading-javascript-files-in.html "

(function() {        
  var s = [
    "/javascripts/script1.js",
    "/javascripts/script2.js"
  ];

  var sc = "script", tp = "text/javascript", sa = "setAttribute", doc = document, ua = window.navigator.userAgent;

  for(var i=0, l=s.length; i<l; ++i) {
    if(ua.indexOf("MSIE")!==-1 || ua.indexOf("WebKit")!==-1) {
      doc.writeln("<" + sc + " type=\"" + tp + "\" src=\"" + s[i] + 
          "\" defer></" + sc + ">");
    } else {
      var t=doc.createElement(sc);
      t[sa]("src", s[i]);
      t[sa]("type", tp);
      doc.getElementsByTagName("head")[0].appendChild(t);
    }
  }
})();
Run Code Online (Sandbox Code Playgroud)

要么

var s = [
    "/javascripts/script1.js",
    "/javascripts/script2.js"
]; …
Run Code Online (Sandbox Code Playgroud)

javascript

8
推荐指数
2
解决办法
455
查看次数

vb6 - 如何传递参数函数?

如何通过参数传递函数,稍后在VB6中调用?将是我需要的东西,可以是以下任何选项:

Private Sub Command1_Click()

    Call callMethod(MyPrivateFunction)
    Call callMethod(MyPublicFunction)
    Call callMethod(MyPrivateSub)
    Call callMethod(MyPublicSub)

End Sub

Private Function MyPrivateFunction()
    MsgBox "MyPrivateFunction"
End Function

Public Function MyPublicFunction()
    MsgBox "MyPublicFunction"
End Function

Private Sub MyPrivateSub()
    MsgBox "MyPrivateSub"
End Sub

Public Sub MyPublicSub()
    MsgBox "MyPublicSub"
End Sub

Public Function callMethod(ByRef func As Object)
    Call func
End Function
Run Code Online (Sandbox Code Playgroud)

vb6

8
推荐指数
1
解决办法
1万
查看次数

javascript:函数调用自身

我想以下代码:

jQuery("#mybutton").click(function(){

    //do something

});
Run Code Online (Sandbox Code Playgroud)

我怎么能记得这个函数"匿名"?,我不能给这个函数命名:

var xfun = function(){

    //do something

}

jQuery("#mybutton").click(xfun);
Run Code Online (Sandbox Code Playgroud)

我可以这样做:

var working = false;
jQuery("#mybutton").click(function(){

  if (working){
    var _this = this;
    _this._eventType = e.type;
    setTimeout(function() { jQuery(_this).trigger(_this._eventType); }, 200);
    return false;
  }
  //do something

});
Run Code Online (Sandbox Code Playgroud)

我需要的是这样的事情:

var working = false;
jQuery("#mybutton").click(function(){

  if (working){
    setTimeout( this_function, 200);
    return false;
  }
  //do something

});
Run Code Online (Sandbox Code Playgroud)

谢谢.

编辑:

解:

jQuery("#mybutton").click(function(){
  if (working){
    var fn = arguments.callee;
    var _this = this;
    setTimeout(function(){fn.call(_this);}, 200);
    return false;
  }
  //do something    
});
Run Code Online (Sandbox Code Playgroud)

javascript jquery

8
推荐指数
1
解决办法
1万
查看次数

Eazfuscator.使用DataGridView控件时发生错误

我的代码如下:

IList<Users> myData = new List<Users>();

myData = HelperUsers.GetUsersList(); // return IList<Users>

BindingSource bsUsers = new BindingSource { DataSource = myData };
dataGridViewUsers.DataSource = bsUsers;

dataGridViewUsers.Columns["Name"].HeaderText = "Name";
dataGridViewUsers.Columns["LastName"].HeaderText = "Last name";

dataGridViewUsers.Invalidate();
Run Code Online (Sandbox Code Playgroud)

仍然可以在调试中完美地工作,但是当在"对象引用未设置为对象的实例"错误之后发生重新编译时.在线:

dataGridViewUsers.Columns["Name"].HeaderText = "Name";
Run Code Online (Sandbox Code Playgroud)

谢谢

c# datagridview winforms eazfuscator

8
推荐指数
1
解决办法
1267
查看次数