index.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Input Your website</title>
  6. <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
  7. <style>
  8. .css-input { margin-bottom: 0; text-shadow:0px 0px 0px rgba(42,42,42,.75); text-align:left; border-radius:8px; border-width:3px; border-style:solid; background-color:#ffffff; border-color:#419fd1; box-shadow: -7px 0px 10px 0px rgba(7,76,214,.0); font-weight:normal; font-family:sans-serif; font-size:16px;width:500px }
  9. .css-input:focus { outline:none; }
  10. .btn {
  11. display: inline-block;
  12. padding: 6px 12px;
  13. margin-bottom: 0;
  14. font-size: 14px;
  15. font-weight: 400;
  16. line-height: 1.42857143;
  17. text-align: center;
  18. white-space: nowrap;
  19. vertical-align: middle;
  20. -ms-touch-action: manipulation;
  21. touch-action: manipulation;
  22. cursor: pointer;
  23. -webkit-user-select: none;
  24. -moz-user-select: none;
  25. -ms-user-select: none;
  26. user-select: none;
  27. background-image: none;
  28. border: 1px solid transparent;
  29. border-radius: 4px;
  30. color: #fff;
  31. background-color: #337ab7;
  32. border-color: #2e6da4;
  33. margin-left: 10px;
  34. }
  35. </style>
  36. <script type="text/javascript">
  37. $(document).ready(function () {
  38. $("#button").click(function () {
  39. if($("#url").val() == '') return false;
  40. $.ajax({
  41. //cache: true,
  42. type: "POST",
  43. url: 'u2s.php',//提交的URL
  44. data: $('#shorturl').serialize(), // 要提交的表单,必须使用name属性
  45. //async: false,
  46. success: function (data) {
  47. $("#result").html(data);//输出提交的表表单
  48. },
  49. error: function (request) {
  50. alert("Connection error");
  51. }
  52. });
  53. return false;
  54. });
  55. });
  56. </script>
  57. </head>
  58. <body>
  59. <h2>请输入需要转换的网址</h2>
  60. <form id="shorturl" action method="POST">
  61. <input type="text" id="url" name="url" class="css-input" ><button class="btn" id="button">提交</button>
  62. </form>
  63. <div id="result"></div>
  64. </body>
  65. </html>