zoukankan      html  css  js  c++  java
  • 每日记载内容总结3

    1.java代码中的匹配

    manufName.matches("\\d+")或者checkNumChar.test(sellerStockNo)

    2.js里面style的写法

    document.getElementById("tt").style.backgroundColor='red'  省略-变为大写
    

     3.在jsp页面里面select中显示年份

    <select name="yearMade" id="select">
    		<c:forEach begin="1" end="70" var="i">
    								<option value="${2013-i}"
    ${productBean.yearMade eq 2013-i ? "selected='selected'" : ""} >${2013-i}</option>
    		</c:forEach>
    </select>
    

     4.servlet在web.xml里面配置主页面

    tomcat6  welcome-file 里面不能配置servlet  要想进页面跳转指定的servlet可以如下进行:
    在web.xml里面配置

    <welcome-file-list>
      <welcome-file>welcome.jsp</welcome-file>
        <welcome-file>InitIndexServlet</welcome-file>
    </welcome-file-list>
    


    在jsp页面建立welcome.jsp 内容如下:
    <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
    <%
    response.sendRedirect(request.getContextPath()+"/InitIndexServlet");
    %>
    即可跳转指定的servlet进入主页面

    tomcat7可以配置主页面

    5.用jquery判断checkbox是否被选中 var hello=$("#toinquiry").is(":checked");

    6.在form中根据条件判断是否跳转

    function Y(){
        alert("hello");
        return true ;
    }
    function X(){
        alert("world");
        return true ;
    }
    </script>
    <form action="test.html" method="POST" name="A" onsubmit="return X();">
    <input type="text" value="" />
    <input onclick="return Y()" type="submit" value="提交" />
    </form>

    自己写X()、Y()函数,我们会发现,这几个函数的执行顺序
    1) onclick: Y();
    2) onsubmit: X();
    3) submit();
    也就是说
    只要 onclick 未 return false 那么就继续执行 onsubmit
    只要 onsubmit 未return false 那么表单就被提交出去了
    另外一点写法上注意一定要 “return X();” 才能取得函数的返回值,否则只是调用函数,返回值未被传递

     故以上实例的结果为:屏幕alert  出来 hello  world  然后跳转页面

  • 相关阅读:
    Open source cryptocurrency exchange
    Salted Password Hashing
    95. Unique Binary Search Trees II
    714. Best Time to Buy and Sell Stock with Transaction Fee
    680. Valid Palindrome II
    Java compiler level does not match the version of the installed Java project facet.
    eclipse自动编译
    Exception in thread "main" java.lang.StackOverflowError(栈溢出)
    博客背景美化——动态雪花飘落
    java九九乘法表
  • 原文地址:https://www.cnblogs.com/cuiyf/p/2917375.html
Copyright © 2011-2022 走看看