⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edit_auto_complete.rhtml

📁 ajax修炼之道源代码。很难下到的。现在奉献给大家。
💻 RHTML
字号:
<!-- ! Excerpted from "Pragmatic Ajax" ! We make no guarantees that this code is fit for any purpose.  ! Visit http://www.pragmaticprogrammer.com/titles/ajax for more book information.--><html>   <head>     <title>Customer Data Screen</title>          <style type="text/css">       th { text-align: left; }       div.auto_complete {	 width: 350px;	 background: #fff;       }       div.auto_complete ul {	 border:1px solid #888;	 margin:0;	 padding:0;	 width:100%;	 list-style-type:none;       }       div.auto_complete ul li {	 margin:0;	 padding:3px;       }       div.auto_complete ul li.selected { 	 background-color: #ffb;        }       div.auto_complete ul strong.highlight { 	 color: #800; 	 margin:0;	 padding:0;       }     </style>          <%= javascript_include_tag 'prototype', 'effects', 'dragdrop', 'controls' %>          <%= javascript_tag <<-END	 function update_fields(xhr) {	     result = xhr.responseText.split(',');	     $('address_city').value = result[0];	     $('address_state').value = result[1];	 }     END     %>        </head>   <body>       <h1>Corporate CRM System</h1>       <h2>Enter Customer Data</h2>              <table>	   <tr>	       <td>Customer Name:</td>	       <td><%= text_field 'address', 'name', {:size => 30} %></td>	   </tr>	   <tr>	       <td>Address:</td>	       <td><%= text_field 'address', 'address', {:size => 30} %></td>	   </tr>	   <tr>	       <td>City:</td>	       <td><div id="city"><%= text_field 'address', 'city', {:size => 20} %></div></td>	   </tr>	   <tr>	       <td>State:</td>	       <td><div id="state"><%= text_field 'address', 'state', {:size => 3, :maxlength => 2} %></div></td>	   </tr>	   	   <tr>             <td>Zip:</td>                	     <td>               <%= text_field 'address',                              'zip',                               {:autocomplete => 'off'} %>               <div class="auto_complete" id="address_zip_auto_complete">               </div></td>	       <%= auto_complete_field 'address_zip',                                       :url => {:action => 'get_zips'} %>		<%= observe_field :address_zip,                                  :url => {:action => 'get_city_state_parse_data'},                                  :with => "'zip=' + value",                                  :complete => 'update_fields(request);'%>	   </tr>	   	   <tr>	       <td></td>	       <td><%= submit_tag %></td>	   </tr>       </table>	<div id="one">&nbsp;</div>	<div id="three">&nbsp;</div>          </body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -