小编rjd*_*olb的帖子

如何使用 jQuery 在表单上以红色字体显示错误消息?

我正在使用 PHP 和 smarty。我对 jQuery 有点陌生。我在 jQuery 中编写了一个函数并在表单提交时调用了这个函数。目前我在警报中显示错误消息。但要求是它应该显示在表单上方,并且应该突出显示有错误的字段。在这两种情况下,字体颜色都应该是红色。供您参考,我正在粘贴我的 smarty 模板代码(即表单代码)。

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
  <tr>
    <td align="left" valign="top"><h3>Contact Lists >> {$bread_crumbs_text}</h3></td>
  </tr>
  <tr>
    <td valign="top">
      <table width="99%" border="0" cellpadding="0" cellspacing="0" class="manage_box" >
        <tr>
          <td>
            <div id="contact_list_import">
              <form name="manage_contact_list_import" id="manage_contact_list_import" action="contact_list_import.php" method="post">
                <input type="hidden" name="op" id="op" value="{$op}">
                <input type="hidden" name="contact_list_id" id="contact_list_id" value="{$contact_list_id}"> 
                <input type="hidden" name="form_submitted" id="form_submitted" value="yes"> 
                <table width="99%" border="0" cellpadding="5" cellspacing="5">
                  <tr>
                    <td colspan="3" class="errorMsg">{$error_msg.error_msgs}</td>
                  </tr>
                  <tr height="30" id="user_option">
                    <td width="300">
                       <input type="checkbox" id="users" name="users_choice" value="users"/>Users 
                    </td> …
Run Code Online (Sandbox Code Playgroud)

javascript php error-handling jquery smarty

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

尝试安装nodejs pm2模块时出错

我正在尝试安装pm2模块,但我遇到了这个错误.操作系统是Ubuntu 14.04 Beta2.Node.js版本是0.10.25,npm - 1.4.7.我究竟做错了什么?

halkar@halkar-nb-ubuntu:~/source$ sudo npm install pm2 -g
.......
npm http 304 https://registry.npmjs.org/fsevents
npm http 304 https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/recursive-readdir
npm http 304 https://registry.npmjs.org/configurable
npm WARN optional dep failed, continuing fsevents@0.2.0

> usage@0.3.9 install /usr/lib/node_modules/pm2/node_modules/usage
> node-gyp rebuild

Usage: gyp_main.py [options ...] [build_file ...]

gyp_main.py: error: no such option: --no-parallel
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:340:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17) …
Run Code Online (Sandbox Code Playgroud)

node.js npm pm2

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

合并tensorboard的摘要时出错

我正在尝试为MNIST初学者教程生成图形,但是收到以下错误.出于某种原因,merged_summary_op对象为None.

Traceback (most recent call last):
  File "mnist1.py", line 48, in <module>
    summary_str = sess.run(merged_summary_op)
  File "/home/vagrant/anaconda2/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 307, in run
    % (subfetch, fetch, type(subfetch), e.message))
TypeError: Fetch argument None of None has invalid type <type 'NoneType'>, must be a string or Tensor. (Can not convert a NoneType into a Tensor or Operation.)
Run Code Online (Sandbox Code Playgroud)

我想我在这里错过了一步.我首先启动了会话,然后运行语句:

merged_summary_op = tf.merge_all_summaries()
Run Code Online (Sandbox Code Playgroud)

tensorflow tensorboard

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

使用 nginx 作为 websocket 连接的代理

如何使用 nginx 作为 websocket 的代理?如果我需要从 clientSite.com( javascript) 连接到 socketSite.com:port 并且我不会显示用户的链接“socketSite.com:port”

我可以使用 nginx 代理重定向来自/到 websocket 服务器的请求吗?

nginx websocket

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

Angular material2与复杂对象列表的自动完成绑定不会按预期运行

与复杂对象的自动完成绑定不会按预期运行.我想将自动完成绑定到复杂对象列表并将选定的复杂对象分配给另一个,但是当我这样做时,它会在自动完成中显示[对象对象].我还创建了plunker来说明问题

目前它只适用于字符串的数组列表.而不是使用纯字符串列表的绑定列表将其与复杂对象列表绑定.

我正在使用Angular Material v2.0.0 -beta.3 Plunker Link

angular-material angular

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

边框颜色引导程序@print不起作用

$("#print_btn_tm").click(function() {
            var link = '<link href=<?php echo base_url("../bootstrap/css/bootstrap.css") ?> rel="stylesheet" />';
            var divContents2 = link+$("#print1").html();
            var printWindow2 = window.open('', '', 'height=400,width=600');

            setTimeout(function (){
                printWindow2.document.write(divContents2);
            },1500);
            setTimeout(function (){
                printWindow2.print();
                printWindow2.close();
            },2000);
        });
Run Code Online (Sandbox Code Playgroud)
.table thead tr td,.table tbody tr td{
        border-width: 1px;
        border-style: solid;
        border-color: black;
        font-size: 10px;
        padding:0px;
    }
    .scc{
        font-size: 10px;
        }
    @media print{
        .table thead tr td,.table tbody tr td{
            border-width: 1px;
            border-style: solid;
            border-color: black;
            font-size: 10px;
            background-color: red;
            padding:0px;
            -webkit-print-color-adjust:exact;
        }
    }
Run Code Online (Sandbox Code Playgroud)
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script …
Run Code Online (Sandbox Code Playgroud)

html css jquery twitter-bootstrap

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

如何从 Postman Response 下载附件

我有一个 API,它发送具有以下标头的响应:

Headers(8)
Test Results(1/1)
Status:200 OK
Time:5890 ms
Size:1.24 MB
Access-Control-Allow-Origin ?*
Cache-Control ?no-cache
Content-Disposition ?attachment; filename=Report.csv
Content-Length ?1298149
Content-Type ?text/csv
Date ?Fri, 22 Jun 2018 08:50:05 GMT
Expires ?-1
Pragma ?no-cache
Run Code Online (Sandbox Code Playgroud)

我想下载附件文件'Report.Csv'

谁能建议我如何通过脚本或纽曼做到这一点

postman newman postman-collection-runner

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

如何登录到 Weblogic 12c 中的日志文件

我多年来一直在使用 Tomcat、JBoss、Glassfish 等。在这些容器中,我使用了 Log4j、JDK Logging 等。这非常简单。

我正在努力从 Weblogic 12c 中的应用程序中获取任何日志记录。日志被写入 stderr 而不是日志文件。

private final static Logger log = Logger.getLogger(TestingService.class.getName()); 
log.log(Level.SEVERE,"My log " + text);
Run Code Online (Sandbox Code Playgroud)

在管理控制台日志实现中:JDK 严重级别:INFO

如果我按照 log4j Weblogic 配置过程配置 Log4J,则行为是相同的。

java logging weblogic weblogic12c

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

选择器在我的网站上被解释为HTML.攻击者可以轻易利用这个吗?

我有一个只能通过https访问的网站.

它不会从其他来源加载任何内容.所以所有内容都在本地网络服务器上.

使用Retire.js Chrome插件我得到一个警告,我所包含的jquery 1.8.3容易被'Selector解释为HTML'(jQuery bug 11290)

我正在努力推动快速升级,但我需要一些更具体的信息来激励升级到权力.我的问题是:

  • 鉴于上述情况,我应该担心吗?

  • 这会导致XSS类型攻击吗?

html javascript security jquery

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

从angular2*ngFor数组中获取特定值

我有这个购物车组件,用于从后端获取购物车数据.

import { Component, OnInit } from '@angular/core';

import { CartService } from './cart.service';

@Component({
    selector: 'cart',
    templateUrl: './cart.component.html',
    styleUrls: ['./cart.component.css']
})

export class CartComponent implements OnInit{
    carts: any;
    cartItems: any;
    totalPrice: Number;

    constructor(private _cartService: CartService){};

    ngOnInit(){
        this.getItems();
    }

    getItems(){
        this._cartService.getCartItems(localStorage.getItem('currentUserId'))
            .subscribe((cart) => {
                this.cartItems = cart.products;
                this.totalPrice = cart.totalPrice;
                this.carts = cart;
                console.log(this.carts)
            },
            (err) => console.log(err));
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的对象值.

在此输入图像描述

我将所有产品放在我的组件中显示的cartItems中,并使用*ngFor将其循环到我的模板中

<tbody *ngFor="let cartItem of cartItems">
Run Code Online (Sandbox Code Playgroud)

这是结果

在此输入图像描述

现在我想更新一个项目的数量,按下删除按钮旁边的刷新按钮,然后它将只发送我按下刷新按钮到后端的产品详细信息.

有人可以帮我解决这个问题吗?

angular

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

Java类定义

b/w类继承和嵌套是否有区别.或者他们都是一样的?

我们可以通过super关键字访问超类变量如何访问innerclass变量?

class Outerclass
{
  static int c;
  int d=5;
  static class Inner
  {
    int a =9;
  }
  class NestedInner
  {
    int b=10;
  }
}

class Test
{
  public static void main(String args[]){
    Outerclass Oc=new Outerclass();
    Outerclass.Inner n=Oc.new Inner();
    System.out.println("....a is...."+n.a);
  }     
}
Run Code Online (Sandbox Code Playgroud)

java

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

使用Chart.jscanvases将HTML内容导出为PDF

我有一个HTML页面,其中包含由chart.js生成的大约10个图表(所以这些是canvas元素)。我希望能够将页面内容导出为PDF文件。

我尝试使用jsPDF的.fromHTML函数,但是它似乎不支持导出画布内容。(或者是我做错了)。我只是做了类似的事情:

    $(".test").click(function() {
  var doc = new jsPDF()

  doc.fromHTML(document.getElementById("testExport"));
  doc.save('a4.pdf')
});
Run Code Online (Sandbox Code Playgroud)

任何替代方法将不胜感激。

javascript jspdf chart.js

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