<!doctype html>
<html lang="ja">
<head>
<meta charset="utf-8">
<script>
_buildWindow: function(titleText,contentText){
//コンテナとなるdiv要素を生成する
var container=document.createElement('div');
</div> //テンプレートからタイトル、コンテンツそれぞれに指定されたHTMLを挿入する title.innerHTML=titleText; content.innerHTML=contentText;//テンプレート情報を格納している要素(<script>要素)からHTMLテキストを取得 var templateElement=document.getElementById('template-buttons'); container.innerHTML=templateElement.innerHTML; //テンプレートからタイトル、コンテンツ要素を取得 var title=container.querySelector('.popwindow-title'); var content=container.querySelector('.popwindow-content'); //タイトル、コンテンツそれぞれに指定されたHTMLを挿入する title.innerHTML=titleText; content.innerHTML=contentText; //生成したコンテナ要素を返す return container; }, var container = document.createElement('div'); <script id="template-window" type="text/x-template"> <div class="popwinow-title"></div> <div class="popwinow-content"></div> <div class="popwindow-buttons"> <p class="popwindow-button-yes"><input type="button" value="Yes"/></p> <p class="popwindow-button-no"><input type="button" value="No"/></p> </div> <script id="template-buttons" type="text/x-template"> <div class="popwindow-title"></div> <div class="popwindow-content"></div> <div class="popwindow-buttons"> <p class="popwindow-button-yes"><input type="button" value="Yes"/></P> <p class="popwindow-button-no"><input type="button" value="No"/></p>
</script> </head> <body> 教本164ページより~173 </body> </html>//thisを変数に保存 var that=this; //Yesボタン押下時の処理 var yesBtn = this.el.querySelector('.popwindow-button-yes'); yesBtn.addEventListener('click',function(e){ that._yesHandler(e); },false); //NOボタンがあるときにだけイベントを付与 var noBtn=this.el.querySelector('.popwindow-button-no'); if(conf.buttonType===Popwinow.buttonType.YESNO){ //Noボタンの押下時の処理 noBtn.addEventListener('click',function(e){ that._noHandler(e); },false); }else{ noBtn.style.display='none'; } //イベントトリガー trigger:function(type,data){ var handlers=this._handlers ||(this._handlers={}); var handler=handlers[type] ||(handlers[type]=[]); for(var i=0,l=handler.length;i<l;i++){ handler[i](data); } }, //イベントリスナーの登録 addEventListener:function(type,callback){ var handlers=this._handlers||(this._handlers={}); var handler=handlers[type]||(handlers[type]=[]); handler.push(callback); }, //イベントリスナーの解除 removeListener:function(type,callback){ var handlers=this._handlers||(this._handlers={}); var handler=handlers[type]||(handlers[type]=[]); var len=handler.length; while(len--){ if(handler[len]===callback){ handler.splice(len,1); break; } } }
このようなコードを記述しました。
しかし、いくら検索してもエラーの解決法がわかりません。
エラーとなっているのは<script>のすぐ下のコードです。
よろしくお願いします。