URLからの引数をJavaScriptに渡す方法

URLからの引数をJavaScriptに渡す方法

http://www.kalium.net/js.html?1234

という様に”?”以降に引数を入れる場合、

<script type="text/javascript">
var foo = location.href.split("?")[1];
document.write("foo: " + foo );
</script>

といった書き方で、
引数を変数に代入できる。

2006年 6月 15日 | Posted in HTML
タグ:
まだコメントはありません。

コメントする

XHTML: 使用可能タグ: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>