Skip to content

Instantly share code, notes, and snippets.

@yuily
Created January 24, 2015 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuily/e118ecfad62a9c7daf02 to your computer and use it in GitHub Desktop.
Save yuily/e118ecfad62a9c7daf02 to your computer and use it in GitHub Desktop.
【JavaScript】文字列の結合とinnerHTML
target = document.getElementById("output");
//セレクトボックス、日付、金額を文字列結合
var f = document.kirokubox.utilityCharges;
for(var i = 0 ; i < f.options.length ; i++){
if(f.options[0].selected){
target.innerHTML = ('<pre class="output_hizuke">今月の'+ f.options[0].value +'料金</pre>'+'<pre class="output_kingaku">●'+ lastmonth + "月" + day + "日~"+ month + "月" + day + "日 " + ryoukin +"円</pre>");
} else if(f.options[1].selected) {
target.innerHTML = ('<pre class="output_hizuke">今月の'+ f.options[1].value +'料金</pre>'+'<pre class="output_kingaku">●'+ lastmonth + "月" + day + "日~"+ month + "月" + day + "日 " + ryoukin +"円</pre>");
} else if(f.options[2].selected){
target.innerHTML = ('<pre class="output_hizuke">今月の'+ f.options[2].value +'料金</pre>'+'<pre class="output_kingaku">●'+ twomonth + "月" + day + "日~"+ month + "月" + day + "日 " + ryoukin +"円</pre>");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment