Greetings,
I am trying to create new layers on the fly and give them a class property so that they can be draggable. For some reason they are not able to use the drab property even though I am giving them the class drag attribute. Here is the function that I use to add the new div layer. Drag is the name of the class that I want the new layers to use, it is also a javascript function.
function clickSchedule(id,L,T,W,H,bgColor,visible,zIndex) {
if (document.layers) {
if (document.layers[id]) {
alert (‘Layer with this ID already exists!’)
return
}
x=event.clientX
var LR=document.layers[id]=new Layer(W)
LR.name= id
LR.left= event.clientX
LR.top = T
LR.clip.height=H
LR.className = drag
LR.visibility=(null==visible || 1==visible ? ‘show’ : ‘hide’)
if(null!=zIndex) LR.zIndex=zIndex
if(null!=bgColor) LR.bgColor=bgColor
}
else if (document.all) {
if (document.all[id]) {
alert (‘Layer with this ID already exists!’)
return
}
var LR= ‘n<DIV id=’+id+’ style=”position:absolute’
+’; left:’ +event.clientX
+’; top:’+T
+’; width:’+W
+’; height:’+H
+’; clip:rect(0,’+W+’,’+H+’,0)’
+’; class: drag ‘
+’; border: #000000 2px solid’
+’; visibility:’+(null==visible || 1==visible ? ‘visible’:’hidden’)
+(null==zIndex ? ” : ‘; z-index:’+zIndex)
+(null==bgColor ? ” : ‘; background-color:’+bgColor)
+'”></DIV>’
document.body.insertAdjacentHTML(“BeforeEnd”,LR)
}
}
Any ideas on what I am doing wrong? I am completely new to javascript coming from oo programming languages.
Thanks,
Kevin