小编RGS*_*RGS的帖子

如何在使用javascript验证一次后禁用按钮?

首先,我想验证输入的一些字段值.之后当我单击提交按钮时,必须在单击后禁用该按钮以避免重复提交.怎么用javascript做到这一点?

<script type="text/javascript" language="javascript">
    function ValidateIt() {
      if (document.getElementById('ddlProblemCategory').value == 0) {
           alert("Please fill some value");
           return false;
      }
           return true;
    }
    function DisableIt() {
        if (ValidateIt() == true)
          document.getElementById('btnSaveProblem').disabled = true;
    }  
</script>
Run Code Online (Sandbox Code Playgroud)

javascript

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

如何在移动设备上修复jQuery DataTables中的scrollX移动问题?

我使用下面的代码来模拟带有垂直和水平滚动条的固定标题.请参阅jsFiddle上的示例.

$('#liveTable').dataTable({
      'bSort': false,
      'destroy': true,
      'aoColumns': [
                    { sWidth: "85px", bSearchable: false, bSortable: false },
                    { sWidth: "75px", bSearchable: false, bSortable: false },
                    { sWidth: "80px", bSearchable: false, bSortable: false },
                    { sWidth: "80px", bSearchable: false, bSortable: false },
                    { sWidth: "85px", bSearchable: false, bSortable: false },
                    { sWidth: "70px", bSearchable: false, bSortable: false },
                    { sWidth: "70px", bSearchable: false, bSortable: false },
                    { sWidth: "50px", bSearchable: false, bSortable: false }
                ],
      'scrollY': 200,
      'scrollX': true,
      'info': …
Run Code Online (Sandbox Code Playgroud)

javascript datatables datatables-1.10

7
推荐指数
1
解决办法
684
查看次数

在负载平衡情况下使用WCF 4.5 RemoteEndpointMessageProperty获取客户端IP地址

我在IIS中托管了WCF 4.5 Restful服务,我正在尝试使用RemoteEndpointMessageProperty来获取使用该服务的客户端的IP地址.

代码1:

private string GetClientIP()
{
  OperationContext context = OperationContext.Current;
  MessageProperties prop = context.IncomingMessageProperties;
  RemoteEndpointMessageProperty endpoint =
         prop[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
  string ip = endpoint.Address;
  return ip;
}
Run Code Online (Sandbox Code Playgroud)

代码2:

private string GetClientIP()
{
  string retIp = string.Empty;
  OperationContext context = OperationContext.Current;
  MessageProperties prop = context.IncomingMessageProperties;
  HttpRequestMessageProperty endpointLoadBalancer =
  prop[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
  if (endpointLoadBalancer.Headers["X-Forwarded-For"] != null)
  {
    retIp = endpointLoadBalancer.Headers["X-Forwarded-For"];
  }
  if (string.IsNullOrEmpty(retIp))
  {
    RemoteEndpointMessageProperty endpoint =
                prop[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
                retIp = endpoint.Address;
  }
  return retIp;
}
Run Code Online (Sandbox Code Playgroud)

但是,由于WCF服务托管在负载均衡器后面的IIS中,因此我获得的IP地址始终是负载均衡器的IP.有没有办法解决这个问题,以便我可以获得客户的真正IP?

c# asp.net wcf load-balancing wcf-rest

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

如何将加载微调器图像添加到jquery选项卡中的每个选项卡?

我已经在jquery选项卡中加载了项目.页面加载时,我想显示加载微调器图像到选项卡内可用的每个选项卡.当显示计数标签时,我想删除微调器图像.我的代码是

Html代码:

<div id="tabs" >
    <ul>
        <li>
            <a id="storesa">
                <p class="tablip">
                    Store 
                    <img id="imgStore" src="ajax-loader6.gif" style="display:none;"/>  
                    <span id="store_count"/>
                </p>
            </a>
        </li>
    </ul>
</div>
Run Code Online (Sandbox Code Playgroud)

Jquery代码:

$(window).load(function () {
    if ($('#store_count').is(':visible')) {
        $('#imgStore').hide();
    }       
});
Run Code Online (Sandbox Code Playgroud)

怎么做?

jquery jquery-ui jquery-ui-tabs

3
推荐指数
1
解决办法
4189
查看次数

SignalR未加载.请确保在〜/ signalr/js之前引用jquery.sigalR-x.js

我在页面中动态引用了两个库.当我浏览我的应用程序时,下面提到的错误没有进入Chrome浏览器.但在Internet Explorer中会发生错误.

var signalRLibrary = document.createElement('script');
signalRLibrary.type = "text/javascript";
signalRLibrary.src = 'jquery.signalR-2.1.2.min.js';
document.getElementsByTagName('head')[0].appendChild(signalRLibrary);

var signlaRHub = document.createElement('script');
signlaRHub.type = "text/javascript";
signlaRHub.src = "~/signalr/hubs";
document.getElementsByTagName('head')[0].appendChild(signlaRHub);
Run Code Online (Sandbox Code Playgroud)

在页面加载期间,由于未加载SignalR,我得到了以下错误.请确保在〜/ signalr/js之前引用了jquery.signalR-x.js.

if (typeof ($.signalR) !== "function") {
        throw new Error("SignalR: SignalR is not loaded. Please ensure jquery.signalR-x.js is referenced before ~/signalr/js.");
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述 在此输入图像描述

asp.net signalr signalr-hub

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

如何从Angular2的prime-ng轮播内的模板获取索引?

我使用下面的代码在 angular 2 中使用 prime-ng carousel 显示从模板标签内的 excel 上传的数据。

exceldata.html:-

<p-carousel headerText="Category" [value]="ExcelRowDatas" class="pcaro">
   <template ngFor let-ExcelRowData [ngForOf]="ExcelRowDatas" let-i="index" pTemplate="item">
       <div class="ui-grid ui-grid-responsive">
          <div class="ui-grid-row">
             <div class="ui-grid-col-6">Index No.</div>
             <div class="ui-grid-col-6">({{i}})</div>
          </div>
          <div class="ui-grid-row">
             <div class="ui-grid-col-6">Place</div>
             <div class="ui-grid-col-6">{{ExcelRowData['Place']}}</div>
          </div>           
       </div>
   </template>
</p-carousel>
Run Code Online (Sandbox Code Playgroud)

exceldata.ts:-

let ExcelRowDatas = [{"Place": "New York"}, {"Place": "London"}, {"Place": "Paris" }]
Run Code Online (Sandbox Code Playgroud)

Plunker:- https://plnkr.co/edit/PUOlAQ7abbAJ7el4ciQ2?p=preview

我无法在 ng-carousel 中获得模板标签内行的索引。但是我能够在不使用 ng-carousel 的情况下获取模板内的索引。如何使用模板获取 ng-carousel 内的索引值?

angular2-template primeng angular

3
推荐指数
1
解决办法
7466
查看次数

Jasmine单元测试中如何触发ngModelChange事件?

我正在使用下面的代码在 Angular 应用程序中使用 Jasmine 来执行单元测试。

测试.组件.html:

<p-treeTable [value]="employees" [columns]="cols" class="employeestreetable">
    <ng-template pTemplate="header" let-columns>
        <tr>
            <th *ngFor="let col of cols" style="width:30px">
                {{col.header}}
            </th>
        </tr>
    </ng-template>
    <ng-template pTemplate="body" let-rowNode let-rowData="rowData"  let-columns="columns">
        <tr [ttRow]="rowNode">
            <td width="30" class="text-right" ttEditableColumn> 
              <p-treeTableToggler [rowNode]="rowNode">
                    </p-treeTableToggler>
                <p-treeTableCellEditor>
                    <ng-template pTemplate="input">
                        <input type="text" pInputText [(ngModel)]="rowData['name']" />
                    </ng-template>
                    <ng-template pTemplate="output">
                        <input type="text" pInputText [(ngModel)]="rowData['name']">
                     </ng-template>
                </p-treeTableCellEditor>
             </td> 
             <td width="30" class="text-right">
                <p-treeTableCellEditor>
                    <ng-template pTemplate="input">
                        <input type="text" pInputText [(ngModel)]="rowData['salary']" (ngModelChange)="calculateTotalSalary(rowNode)" />
                    </ng-template>
                    <ng-template pTemplate="output">
                        <input type="text" pInputText [(ngModel)]="rowData['salary']">
                     </ng-template>
                </p-treeTableCellEditor>
             </td>
             <td width="30" …
Run Code Online (Sandbox Code Playgroud)

jasmine karma-runner karma-jasmine angular

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