駅すぱあとの保持する回数券の一覧や回数券の詳細情報を取得します。 取得した回数券情報は探索に利用でき、回数券を利用した場合の運賃計算にも利用可能です。
インクルード
<script type="text/javascript" src="expGuiLandmark.js?key=keycode"></script>
サンプルコード
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=shift_jis" /> <title> Webサービスサンプル </title> <script type="text/javascript" src="expGuiCoupon.js?key=keycode"> </script> <script type="text/javascript"> <!-- var coupon; /* * パーツを初期化 */ function init(){ // 回数券情報 coupon = new expGuiCoupon(); coupon.searchCoupon(setCouponList); } /* * 回数券一覧取得のコールバック */ function setCouponList(isSuccess){ if(!isSuccess){ alert("回数券一覧が取得できませんでした"); }else{ //回数券詳細一覧の出力 var couponList = coupon.getCouponList().split(","); if(couponList[0] != ""){ setCoupon(couponList[0]); } } } /* * 回数券を選択 */ function setCoupon(couponName){ coupon.searchCouponDetail(couponName,setCouponDetailList); } /* * 回数券詳細一覧取得のコールバック */ function setCouponDetailList(isSuccess){ if(!isSuccess){ alert("回数券詳細一覧が取得できませんでした"); }else{ //回数券詳細一覧の出力 var couponList = coupon.getCouponDetailList().split(","); viewCoupon(couponList[0]); } } /* * 回数券の詳細を表示 */ function viewCoupon(couponName){ var couponObject = coupon.getCouponObject(couponName); var buffer = ""; buffer += "名称:"+ couponObject.name +"\n"; buffer += "枚数:"+ couponObject.count +"枚\n"; buffer += "有効期間:"+ couponObject.validPeriod +"ヵ月\n"; if(couponObject.direction == coupon.DIRECTION_BOTH){ buffer += "設定区間の方向:両方向で利用可能\n"; }else if(couponObject.direction == coupon.DIRECTION_DEFINE){ buffer += "設定区間の方向:定義された方向のみ利用可能\n"; } buffer += "金額:"+ couponObject.price +"円\n"; alert(buffer); } // --> </script> </head> <body onLoad="Javascript:init();"> </body> </html>