Jump to content
  • 0

Срикпт работает в опере, в мозиле и Ie не хочет


Karapuz
 Share

Question

Подскажите плиз почему скрипт работает только в Опрее, иЕ и Мозила не хотят работать

При наведении на определ?енную область картинки курсора мыши - появляется под курсором ещ? одна картинка

<style type="text/css">
<!--
#pup {
position:absolute; visibility:hidden; z-index:200; width:200;
}
-->
</style>

Функции

<script type="text/javascript">

var Xoffset=-60; // modify these values to ...
var Yoffset= 20; // change the popup position.
var popwidth=130; // popup width
var bcolor="darkgray"; // popup border color
var fcolor="black"; // popup font color
var fface="verdana"; // popup font face

// create content box
document.write("<DIV ID='pup'></DIV>");

// id browsers
var iex=(document.all);
var nav=(document.layers);
var old=(navigator.appName=="Netscape" && !document.layers && !document.getElementById);
var n_6=(window.sidebar);

// assign object
var skin;
if(nav) skin=document.pup;
if(iex) skin=pup.style;
if(n_6) skin=document.getElementById("pup").style;

// park modifier
var yyy=-1000;

// capture pointer
if(nav)document.captureEvents(Event.MOUSEMOVE);
if(n_6) document.addEventListener("mousemove",get_mouse,true);
if(nav||iex)document.onmousemove=get_mouse;

// set dynamic coords
function get_mouse(e)
{
var x,y;

if(nav || n_6) x=e.pageX;
if(iex) x=event.x+document.body.scrollLeft;

if(nav || n_6) y=e.pageY;
if(iex)
{
y=event.y;
if(navigator.appVersion.indexOf("MSIE 4")==-1)
y+=document.body.scrollTop;
}

if(iex || nav)
{
skin.top=y+yyy;
skin.left=x+Xoffset;
}

if(n_6)
{
skin.top=(y+yyy)+"px";
skin.left=x+Xoffset+"px";
}
nudge(x);
}

// avoid edge overflow
function nudge(x)
{
var extreme,overflow,temp;

// right
if(iex) extreme=(document.body.clientWidth-popwidth);
if(n_6 || nav) extreme=(window.innerWidth-popwidth);

if(parseInt(skin.left)>extreme)
{
overflow=parseInt(skin.left)-extreme;
temp=parseInt(skin.left);
temp-=overflow;
if(nav || iex) skin.left=temp;
if(n_6)skin.left=temp+"px";
}

// left
if(parseInt(skin.left)<1)
{
overflow=parseInt(skin.left)-1;
temp=parseInt(skin.left);
temp-=overflow;
if(nav || iex) skin.left=temp;
if(n_6)skin.left=temp+"px";
}
}

// write content & display
function popup(msg,bak)
{

var content="<TABLE WIDTH='200' BORDER='0' BORDERCOLOR="+bcolor+" CELLPADDING=2 CELLSPACING=0 "+"BGCOLOR="+bak+"><TD ALIGN='center'><FONT COLOR="+fcolor+" FACE="+fface+" SIZE='2'><img src='image.jpg' width='200' height='120'></FONT></TD></TABLE>";

if(old)
{
alert(msg);
return;
}

yyy=Yoffset;
skin.width=popwidth;

if(nav)
{
skin.document.open();
skin.document.write(content);
skin.document.close();
skin.visibility="visible";
}

if(iex)
{
pup.innerHTML=content;
skin.visibility="visible";
}

if(n_6)
{
document.getElementById("pup").innerHTML=content;
skin.visibility="visible";
}
}


// park content box
function kill()
{
if(!old)
{
yyy=-1000;
skin.visibility="hidden";
skin.width=0;
}
}

//-->
</script>

Код картинки на странице

<img src="karta_mini.jpg" alt="авававвыф" width="750" height="600" border="0" usemap="#kont1" ></a>
<map name="kont1" >
<area onMouseOver="popup('ляляля','red')" onmouseout=kill() shape="circle" coords="585,282,51" href="lalala.html" alt="люлюл">

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy