Проблем с Popup под IE6 IE7

djpatzo

Registered
За много години първо и да сте живи и здрави, най-вече, другото се намества когато тези 2 неща са най-добре.

Та ето го и въпроса. Използвам следния код за отваряне на popup прозорче, но нещо не ми излиза под IE7. Ако може някой да каже да направя номера с това.
Код:
 <BODY onLoad="popup('autopopup.html', 'ad')">
 
Също виж и това
status The status bar at the bottom of the window.
toolbar The standard browser toolbar, with buttons such as Back and Forward.
location The Location entry field where you enter the URL.
menubar The menu bar of the window
directories The standard browser directory buttons, such as What's New and What's Cool
resizable Allow/Disallow the user to resize the window.
scrollbars Enable the scrollbars if the document is bigger than the window
height Specifies the height of the window in pixels. (example: height='350')
width Specifies the width of the window in pixels.
 
Оправих се с един доста спретнат popup.


autopopup.js
Код:
var ns4=document.layers

var ie4=document.all

var ns6=document.getElementById&&!document.all



//drag drop function for NS 4////

/////////////////////////////////



var dragswitch=0

var nsx

var nsy

var nstemp



function drag_dropns(name){

if (!ns4)

return

temp=eval(name)

temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)

temp.onmousedown=gons

temp.onmousemove=dragns

temp.onmouseup=stopns

}



function gons(e){

temp.captureEvents(Event.MOUSEMOVE)

nsx=e.x

nsy=e.y

}

function dragns(e){

if (dragswitch==1){

temp.moveBy(e.x-nsx,e.y-nsy)

return false

}

}



function stopns(){

temp.releaseEvents(Event.MOUSEMOVE)

}



//drag drop function for ie4+ and NS6////

/////////////////////////////////





function drag_drop(e){

if (ie4&&dragapproved){

crossobj.style.left=tempx+event.clientX-offsetx

crossobj.style.top=tempy+event.clientY-offsety

return false

}

else if (ns6&&dragapproved){

crossobj.style.left=tempx+e.clientX-offsetx+"px"

crossobj.style.top=tempy+e.clientY-offsety+"px"

return false

}

}



function initializedrag(e){

crossobj=ns6? document.getElementById("showimage") : document.all.showimage

var firedobj=ns6? e.target : event.srcElement

var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"

while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbar"){

firedobj=ns6? firedobj.parentNode : firedobj.parentElement

}



if (firedobj.id=="dragbar"){

offsetx=ie4? event.clientX : e.clientX

offsety=ie4? event.clientY : e.clientY



tempx=parseInt(crossobj.style.left)

tempy=parseInt(crossobj.style.top)



dragapproved=true

document.onmousemove=drag_drop

}

}

document.onmouseup=new Function("dragapproved=false")



////drag drop functions end here//////



function hidebox(){

crossobj=ns6? document.getElementById("showimage") : document.all.showimage

if (ie4||ns6)

crossobj.style.visibility="hidden"

else if (ns4)

document.showimage.visibility="hide"

}

добавяме следния текст след <body> тага в html-а
Код:
<div id='showimage' align='center' style='position:absolute;width:560px;top:300px'>

<table border='0' width='500' bgcolor='#0f84c1' cellspacing='0' cellpadding='2'>
<tr>
<td width='100%'>
<table border='0' width='100%' cellspacing='0' cellpadding='0' height='40px'>
<tr>
<td id='dragbar' style='cursor:pointer; text-align:center;' width='100%' onMousedown='initializedrag(event)'>
<ilayer width='100%' onSelectStart='return false'>
<layer width='100%' onMouseover='dragswitch=0;if (ns4) drag_dropns(showimage)' onMouseout='dragswitch=0'>
<font face='Verdana' color='#ffffff' style='font-size: 14px;'><strong>ЗАГЛАВИЕ НА ПРОЗОРЧЕТО</strong></font></layer></ilayer></td>
<td style='cursor:hand;'><a style='cursor:hand' href='#' onClick='hidebox();return false'><img src='close.gif' width='14px' height='14px' border='0' style='cursor:hand'>
</a>
</td>
</tr>
<tr>
<td width='100%' bgcolor='#FFFFFF' style='padding:4px;font-size:12px; font-weight:bold; text-align:center;' colspan='2'>



текста на прозорчето



</td>
</tr>
</table>
</td>
</tr>
</table>
</div>

картинката за затваряне на прозореца:
close.gif
 

Back
Горе