zoukankan      html  css  js  c++  java
  • thymeleaf 在 html和js 中拼接字符串

    一、th:text字符串和事件拼接

      1. <span th:text="'Welcome,'+${user.name}">
      2.  <span th:text="|Welcome, ${user.name}|">
      3. input type="button" th:onclick="|javascript:fungetone(${con.uid})|" value = "修改" />
      4. <a href="javascript:void(0) th:onclick='${"goRead("+menu.***+")"}'>
      5. 亲测这种可以  

    二、th:action字符串拼接

      <form th:action="@{'/user/'+${user.userId}}"></form>
      <form th:action="@{/user/{userId}(userId=${user.userId})}"></form>

    JavaScript中

      <script th:inline="javascript">
      $("#content").html(
        "<select name='status'>"+
        " <option value=''>[[#{admin.common.choose}]]</option>"+
        " <option value="+[[${status}]]+">[[#{'Order.Status.' + ${value}}]]</option>"+
        "</select>");
      </script>

    三 拼接url和href

      src示例:

      <img th:src="@{/img/research/{filename}(filename=${research.filename})}">
      href示例:

      <a th:href="@{'https://'+${url.url}}" th:text="${url.urlName}"></a>

  • 相关阅读:
    查看占用内存cpu top10
    free 详解
    find
    服务器硬件查看
    firewalld命令使用
    firewalld-zone概念介绍
    Jenkins rpm包安装
    攻击防御案例
    filebeat收集系统登陆日志
    nginx转换json格式
  • 原文地址:https://www.cnblogs.com/ch94/p/10030591.html
Copyright © 2011-2022 走看看