prototype_before.rhtml

来自「ruby on rails web敏捷开发之路第二版 源代码」· RHTML 代码 · 共 54 行

RHTML
54
字号
<!-- ! Excerpted from "Agile Web Development with Rails, 2nd Ed." ! We make no guarantees that this code is fit for any purpose.  ! Visit http://www.pragmaticprogrammer.com/titles/rails2 for more book information.--><html>  <head>    <script type="text/javascript">function updateCityState() {//  try {//   netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");//  } catch (e) {//  }  if (xhr.readyState == 4) {    document.getElementById('result').innerHTML = xhr.responseText;  }}function lookupZip(value) {//  try {//   netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");//  } catch (e) {//  }  try {    xhr = new XMLHttpRequest();  } catch (e) {}  if (!xhr) {    try {      xhr = new ActiveXObject('Msxml2.XMLHTTP');    } catch (e) {}  }  if (!xhr) {    try {      xhr = new ActiveXObject('Microsoft.XMLHTTP');    } catch (e) {}  }  xhr.onreadystatechange = updateCityState;  xhr.open("GET", '<%= url_for :action=>"lookup_ajax", :only_path=>false %>' + "?zip=" + value);  xhr.send(null);  }    </script>  </head>  <body><h1>Lookup zip</h1><% form_tag 'javascript:void(0)' do %>  <p><label for="zip_zip">Zip</label><br/>  <%= text_field 'zip', 'zip', :onkeyup=>"lookupZip(this.value);", :autocomplete=>"off"  %></p><% end %><div id="result"></div><%= link_to 'List', :action => 'list' %>  </body></html>

⌨️ 快捷键说明

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