2009/12/12作成
[PR]
×
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
ページ移動
関数
// 指定されたページに遷移する
function go(url) {
document.location=url;
}
使用方法(外部jsファイルの関数を使用方法はこちら)
<input type="button" value="次へ" onclick="go('http://www.google.co.jp/');" />
// 指定されたページに遷移する
function go(url) {
document.location=url;
}
使用方法(外部jsファイルの関数を使用方法はこちら)
<input type="button" value="次へ" onclick="go('http://www.google.co.jp/');" />
PR
外部ファイルを使用する
1.html、css、jsの3ファイルを用意する
2.3ファイルを同じフォルダに保存する
3.htmlファイルをブラウザで開く
4.「オレSE」ボタンをクリックし、「オレSE」が出れば成功
ファイル名 | ソース |
---|---|
test.html | <html> <head> <link href="./style.css" rel="stylesheet" type="text/css"> <script src="./script.js"></script> </head> <body> <input type="button" value="オレSE" onclick="showAlert('オレSE');" /> </body> </html> |
style.css | /* body スタイル */ body { background-color:lightgray; } |
script.js | // 警告メッセージを表示する function showAlert(message) { window.alert(message); } |
2.3ファイルを同じフォルダに保存する
3.htmlファイルをブラウザで開く
4.「オレSE」ボタンをクリックし、「オレSE」が出れば成功
新着記事
2013 - 06 - 27
2013 - 06 - 27
2013 - 06 - 19
2013 - 01 - 11
2013 - 01 - 11
カテゴリー
アーカイブ
検索
新着コメント
ブックマーク