jsのhrefに追加のgetパラメータを追加するにはどうすればよいですか? URL の refer_id=xxx を削除してから、新しい refer_id=xxx get パラメータを追加します。URL は一意ではありません。
それを行うための速い方法はありますか?
// http://www.newpm.com/
// http://www.newpm.com/?refer_id=100
// http://www.newpm.com/index.php?main_page=product_info&refer_id=100
// http://www.newpm.com/index.php?main_page=product_info&refer_id=100&from_home
// http://www.newpm.com/index.php?refer_id=100&from_home
例えば:
// http://www.newpm.com/index.php?main_page=product_info&refer_id=100&from_home
refer_id=xxx を置き換えます。取得:
// http://www.newpm.com/index.php?main_page=product_info&&from_home
置換された URL に「&&」が含まれている場合、新しい refer_id を追加します
// http://www.newpm.com/index.php?main_page=product_info&from_home&refer_id=200