I've written the following widget, based on the tutorial example button.js.
Basically, it draws me two types of buttons - one which the user can click
and which acts as a graphical checkbox, the other acts as a graphical
hyperlink (the difference being in onmousedown - if month is there then the
page is changed).
The problem is with Netscape - it doesn't seem to get to the end of the
onmousedown code, and as such doesn't 'let go' of the mouse down event. When
the new page loads, the cursor selects all the html on the page as if the
user is holding down the mouse button.
Can anyone give me a hint as to how to solve this? I'm using Netscape 4.7
and IE5.5, in which there is no problem.
Cheers, Ben
-------------code----------------
DynLayer.prototype.setBckGrdImg=function(obj) {
this.bgImage=obj+'.src';
if (this.css==null) return;
if (is.ns4) {
this.elm.background.src=obj.src;
if (!obj) this.setBgColor(this.getBgColor());
}
else this.css.backgroundImage='url('+obj.src+')';
};
function button(x,y,w,h,caption,imgOn,imgOff,month,year) {
this.superClass=DynLayer
this.superClass()
this.id="button"+(button.Count++)
this.moveTo(x||0,y||0)
this.setSize(w||0,h||0)
this.caption=caption||''
this.imgDir='images/left_nav/'
this.imgOn = new Image()
this.imgOn.src=this.imgDir+imgOn
this.imgOff = new Image()
this.imgOff.src=this.imgDir+imgOff
this.selected=false
var l=new EventListener(this)
l.oncreate=function(e) {
var o=e.getTarget()
o.setBckGrdImg(o.imgOff)
o.dyncaption=new DynLayer(null,0,0,o.w,o.h)
if (o.caption.length>2) o.caption=''
o.dyncaption.setHTML('<center>'+o.caption+'</center>')
o.addChild(o.dyncaption)
o.setVisible(true)
o.dynTopLayer=new DynLayer(null,0,0,o.w,o.h)
o.addChild(o.dynTopLayer)
o.setVisible(true)
}
l.onmousedown=function(e) {
if (month) {
if (year) {
parent.frames[1].location="div_test6.php?month="+month+"&year="+year
} else {
parent.frames[1].location="div_test6.php?month="+month
}
} else {
o.selected?o.setBckGrdImg(o.imgOff):o.setBckGrdImg(o.imgOn)
o.selected?o.selected=false:o.selected=true
}
return false
}
l.onmouseover=function(e) {
var o=e.getTarget()
o.selected?'':o.setBckGrdImg(o.imgOn)
}
l.onmouseout=function(e) {
var o=e.getTarget()
o.selected?'':o.setBckGrdImg(o.imgOff)
return false
}
this.addEventListener(l)
return this
}
button.Count=0
button.prototype=new DynLayer()
button.prototype.getSubClass=function() { return button }
---------end code------------------
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help