This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>jQueryのロード</title> | |
<!-- jQueryを、Google Libraries APIで読み取る。最新版の1.8.3を読み取る。 --> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> | |
<script> | |
<!-- もし、Google Libraries APIが何らかの理由で読み取れなかった場合の処理。 --> | |
window.jQuery || | |
document.write('<script src="jquery-ui.min.js"></script>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//イベントを発生させるオブジェクトを作成 | |
var events = require("events"); | |
var emitter = new events.EventEmitter(); | |
//発生させる関数を定義 | |
var sampleListener = function(arg1){ | |
console.log("arg1"); | |
} | |
//イベント("occurrence")を定義して、関数をむすびつける。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /> | |
<%= javascript_include_tag "application" %> | |
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script> | |
<script> | |
$(document).bind("mobileinit", function(){ | |
$.mobile.ajaxLinksEnabled = false; // Ajax を使用したページ遷移を無効にする | |
$.mobile.ajaxFormsEnabled = false; // Ajax を使用したフォーム遷移を無効にする |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- リンク要素のdata-ajax属性を"false"にする。 --> | |
<a href="page2.html" data-ajax="false">page2へ</a> | |
<!-- リンク要素のrel要素で、"external"を指定する。 --> | |
<a href="page2.html" rel="external">page2へ</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//getParameterメソッドを定義する。 | |
function getParameter(key) { | |
//パラメーターを配列で取得する。 | |
var str = location.search.split("?"); | |
if (str.length < 2) { | |
return ""; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>javascriptでパラメーターを取得。</title> | |
</head> | |
<body> | |
<p>"index.html?key=1&name=taro"でアクセスする。</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#親のArticleモデル | |
def class Article < ActiveRecord::Base | |
has_many :comments | |
end | |
#子のCommentモデル | |
class Comment < ActiveRecord::Base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// view/member/index.html.erb | |
<%= form_for @member,:remote => true,:html => {:id => 'form'} do |form| %> | |
//フォーム | |
<%= form.submit "送信" %> | |
<% end %> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//テキストエリア | |
<textarea id="text_area"></textarea> | |
//残りの文字数の表示 | |
<p>残りの文字数 <span="count"></p> | |
//送信ボタン | |
<input type="submit" value="送信" id="submit"> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chars = ("a".."z").to_a + ("A".."Z").to_a + (0..9).to_a | |
result = "" | |
8.times do | |
result << chars[rand(chars.length)] | |
end | |
result | |
OlderNewer