指定したパラメータの値を取得するための関数。
script.js
function getParam(val) {
var p = location.search;
var v = '(?:(?:^|.*\s*)' + val + '\s*\=\s*([^&]*).*$)|^.*$';
return p.replace(new RegExp(v), '$1');
}
alert(getParam('hoge'));
Go to list of users who liked
More than 5 years have passed since last update.
指定したパラメータの値を取得するための関数。
function getParam(val) {
var p = location.search;
var v = '(?:(?:^|.*\s*)' + val + '\s*\=\s*([^&]*).*$)|^.*$';
return p.replace(new RegExp(v), '$1');
}
alert(getParam('hoge'));
Register as a new user and use Qiita more conveniently
Go to list of users who liked