HTML CSS style:<button></button> button changes to hyperlink <a></a> style

Source: Internet
Author: User

Original: http://blog.csdn.net/qq_16769857/article/details/52055349 [HTML]View PlainCopyprint?
  1. <! DOCTYPE HTML>
  2. <HTML lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>document</title>
  6. <script type="Text/javascript" src="Jquery.min.js"></script>
  7. <style>
  8. . btn {
  9. Color:blue;
  10. Background-color: #FFFFFF;
  11. border:0px none; Go to Border
  12. font-family: "Song Body";
  13. font-size:15px;
  14. Text-decoration:underline; Add underline
  15. }
  16. . btn:hover{
  17. color:red;
  18. Border:none;
  19. Cursor:hand;
  20. Cursor:pointer;
  21. Text-decoration:underline; Add underline
  22. }
  23. . btn:focus {
  24. Outline:none; Go to Border
  25. }
  26. </style>
  27. <script type="Text/javascript">
  28. $ (function () {
  29. $ ("Input:button"). Click (function () {
  30. str = $ (this). val () = = "Edit"? "    OK ":" Edit ";
  31. $ (this). val (str); When the button is clicked, switch between "edit" and "OK"
  32. $ (this). Parent (). Siblings ("TD."). 2-item ' "). each (function () {//Gets the other cells of the current row
  33. Obj_text = $ (this). Find ("Input:text"); Determine if a text box is in the cell
  34. if (!obj_text.length)//If there is no text box, add a text box so that it can be edited
  35. $ (this). The HTML ("<input type=' text ' value='" +$ (This). Text () + "'>");
  36. else//If a text box already exists, display it as a value modified by the text box
  37. $ (this). html (Obj_text.val ());
  38. });
  39. $ (this). Parent (). Siblings ("TD."). 1-item ' "). each (function () {//Gets the other cells of the current row
  40. Obj_text = $ (this). Find ("select"); Determine if a text box is in the cell
  41. if (!obj_text.length)//If there is no text box, add a text box so that it can be edited
  42.                 $ (this). HTML ("<select><option value= ' Volvo ' >volvo</option> <option value= ' Volvo ' >volvo</ Option></select> ");   
  43. else//If a text box already exists, display it as a value modified by the text box
  44. $ (this). html (Obj_text.val ());
  45. });
  46. });
  47. });
  48. </Script>
  49. </head>
  50. <body>
  51. <table>
  52. <tr>
  53. <TD>2</td>
  54. <TD Class="1-item">1</td>
  55. <TD Class="2-item">2</td>
  56. <TD Class="2-item">2</td>
  57. <TD><input class="btn" type="button" value="edit" ></td>
  58. </tr>
  59. <Tr><Td>2</td><td >5</td> <td>< input type= "button"  < span class= "attribute" >name= "btnsubmit"  id= "btnsubmit"   value= "edit "></td> </tr>  
  60. <tr><td >3</td> <td>8</ td><td ><input type=< Span class= "Attribute-value" > "button"  value= "edit" span class= "tag" >></td> </tr>  
  61. <tr><td >4</td> <td>2</ td><td ><input type=< Span class= "Attribute-value" > "button"  value= "edit" span class= "tag" >></td> </tr>  
  62. </table>
  63. </body>
  64. </html>



Note: The style implements the function: The button becomes a hyperlink. Other code is editable table, if it is not possible to refer to the

[HTML]View PlainCopyprint?
      1. <strong><span style="FONT-SIZE:18PX;" >jquery.min.js version Issue </span></strong>

HTML CSS style:<button></button> button changes to hyperlink <a></a> style

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.