いつもお世話になっております。
SampleA.aspxからSampleB.aspxへパラメータを渡したいと考えています。
SampleA.aspxに設定するSampleB.aspxへのパスを方法を教えてください。
絶対パスと相対パスの設定方法がわかりません。
正確に言うとSampleA.aspxの位置からSampleB.aspxの位置をどのように設定したらよいかです。
よろしくお願いします。フォルダ構成は、以下に記載しています。
基本的なことですいません。
SampleA.aspx
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> </head> <body> // ここのパス設定方法がわからない。 <span><a href="/WebFormSample02.aspx?q=ABCD&m=30">次へ</span> </body> </html>
SampleB.aspx
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> <script type="text/javascript"> window.onload = function onLoad() { param = GetQueryString(); target = document.getElementById("param"); target.innerHTML = param["q"]; } function GetQueryString() { if (1 < document.location.search.length) { // 最初の1文字 (?記号) を除いた文字列を取得する var query = document.location.search.substring(1); // クエリの区切り記号 (&) で文字列を配列に分割する var parameters = query.split('&'); var result = new Object(); for (var i = 0; i < parameters.length; i++) { // パラメータ名とパラメータ値に分割する var element = parameters[i].split('='); var paramName = decodeURIComponent(element[0]); var paramValue = decodeURIComponent(element[1]); // パラメータ名をキーとして連想配列に追加する result[paramName] = decodeURIComponent(paramValue); } return result; } return null; } </script> </head> <body> <div>パラメーター</div> <div id="param"></div> </body> </html>
フォルダ構成 |-フォルダA-サブフォルダA-SampleA.aspx | |-フォルダB-サブフォルダB-SampleB.aspx
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/05/10 14:01