私はかなり基本的なjs関数をクラスに適応させています。とにかく、基本的にはメインページの上にフローティングコンテナを作成するだけです。不完全であることは承知していますが、入力中です。close()関数を呼び出そうとすると、問題が発生し続けます。this.sdiv
Firefoxは未定義を返します。close()がPopのメソッドであり、sdivがPopクラスの最初の行で定義されている場合にこれがどのように発生するかについて混乱していますか?
function Pop( wpx,hpx ){
Pop.prototype.sdiv;
Pop.prototype.shadow;
Pop.prototype.pdiv;
// start with the invisible screen, which
// covers the main page
this.sdiv = document.createElement("DIV")
this.sdiv.className = "popScreen";
this.sdiv.id = "popScreen";
// this screen covers the full document, so
// base dimensions on the document size
this.sdiv.style.width = document.body.clientWidth + "px";
this.sdiv.style.height = document.body.clientHeight + "px";
document.body.appendChild( this.sdiv );
// attach drop shadow
this.shadow = document.createElement("DIV");
this.shadow.className = "popShadow";
this.shadow.style.width = wpx + "px";
this.shadow.style.height = hpx + "px";
this.shadow.style.left = ( ( window.innerWidth / 2 ) - ( wpx / 2 ) ) + "px";
this.shadow.style.top = ( ( window.innerHeight / 2 ) - ( hpx / 2 ) ) + "px";
document.body.appendChild( this.shadow );
this.pdiv = document.createElement("DIV");
this.pdiv.className = "pop";
this.pdiv.id = "pop";
this.pdiv.style.position = "absolute";
this.pdiv.style.width = wpx + "px";
this.pdiv.style.height = hpx + "px";
this.shadow.appendChild( this.pdiv );
// bind an event to the screen div so that when it is clicked
// the Pop dialogue is closed and the user is return to the main page
$("div#popScreen").click( function( ){
Pop.prototype.close( );
} );
Pop.prototype.go = function( url, method, data ){
if( method == null )
$("div#pop").load( url );
}
Pop.prototype.close = function( ){
this.sdiv.parentNode.removeChild( this.sdiv );
this.shadow.parentNode.removeChild( this.shadow );
this.pdiv.parentNode.removeChild( this.pdiv );
}
}
助けてくれてありがとう