Ich habe hier im Forum ein Script gefunden das ich gerne einsetzen würde. Ein Problem gibt es nur dabei das das Script alle Texte automatisch immer in der Schrift „Times New..“ anzeigt und ich brauche „Arial“. Sobald ich aber versuche den Text zu formatieren (<font> ….</font>) funktioniert das Script nicht mehr. Kann mir da jemand vielleicht einen Tipp geben. Es würde mir schon reichen wenn alle Texte bei Mouseover in Arial angezeigt werden.
Ich meine genau diese Funktion:
function popLayer(a) {
desc = "<table cellpadding=3 border=1 bgcolor=F7F7F7><td>";
if (a==1) desc += "Text 1";
if (a==2) desc += "Text 2";
if (a==3) desc += "Text 3";
if (a==4) desc += "Text 4";
if (a==5) desc += "Text 5";
Der Text „Text 1“, „Text 2“ usw. soll die Schriftart Arial haben und nicht Times New…..
Hier das komplette Script:
<html>
<head>
<title>Hidden Layer</title>
<script LANGUAGE="JavaScript">
<!-- Begin
function setupDescriptions() {
var x = navigator.appVersion;
y = x.substring(0,4);
if (y>=4) setVariables();
}
var x,y,a,b;
function setVariables() {
if (navigator.appName == "Netscape") {
h=".left=";
v=".top=";
dS="document.";
sD="";
} else {
h=".pixelLeft=";
v=".pixelTop=";
dS="";
sD=".style";
}
}
var isNav = (navigator.appName.indexOf("Netscape") !=-1);
function popLayer(a) {
desc = "<table cellpadding=3 border=1 bgcolor=F7F7F7><td>";
if (a==1) desc += "Text 1";
if (a==2) desc += "Text 2";
if (a==3) desc += "Text 3";
if (a==4) desc += "Text 4";
if (a==5) desc += "Text 5";
desc += "</td></table>";
if(isNav) {
document.object1.document.write(desc);
document.object1.document.close();
document.object1.left=x+25;
document.object1.top=y;
} else {
object1.innerHTML=desc;
eval(dS+"object1"+sD+h+(x+25));
eval(dS+"object1"+sD+v+y);
}
}
function hideLayer(a) {
if(isNav) {
eval(document.object1.top=a);
}
else object1.innerHTML="";
}
function handlerMM(e) {
x = (isNav) ? e.pageX : event.clientX;
y = (isNav) ? e.pageY : event.clientY;
}
if (isNav) {
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
// End -->
</script>
</head>
<body OnLoad="setupDescriptions()">
<div id="object1" style="position:absolute; visibility:show; left:25px; top:-50px; z-index:2">
<p>layer hidden off the screen</p>
</div><a href="" onMouseOver="popLayer(1)" onMouseOut="hideLayer(-50)"><b>
<p align="center">Option 1</b></a> </p>
<p align="center"><b><a href="" onMouseOver="popLayer(2)" onMouseOut="hideLayer(-50)">Option 2</a> </b></p>
<p align="center"><b><a href="" onMouseOver="popLayer(3)" onMouseOut="hideLayer(-50)">Option 3</a> </b></p>
<p align="center"><b><a href="" onMouseOver="popLayer(4)" onMouseOut="hideLayer(-50)">Option 4</a> </b></p>
<p align="center"><b><a href="" onMouseOver="popLayer(5)" onMouseOut="hideLayer(-50)"><img src=""></a> </b></p>
</body>
</html>
Ich meine genau diese Funktion:
function popLayer(a) {
desc = "<table cellpadding=3 border=1 bgcolor=F7F7F7><td>";
if (a==1) desc += "Text 1";
if (a==2) desc += "Text 2";
if (a==3) desc += "Text 3";
if (a==4) desc += "Text 4";
if (a==5) desc += "Text 5";
Der Text „Text 1“, „Text 2“ usw. soll die Schriftart Arial haben und nicht Times New…..
Hier das komplette Script:
<html>
<head>
<title>Hidden Layer</title>
<script LANGUAGE="JavaScript">
<!-- Begin
function setupDescriptions() {
var x = navigator.appVersion;
y = x.substring(0,4);
if (y>=4) setVariables();
}
var x,y,a,b;
function setVariables() {
if (navigator.appName == "Netscape") {
h=".left=";
v=".top=";
dS="document.";
sD="";
} else {
h=".pixelLeft=";
v=".pixelTop=";
dS="";
sD=".style";
}
}
var isNav = (navigator.appName.indexOf("Netscape") !=-1);
function popLayer(a) {
desc = "<table cellpadding=3 border=1 bgcolor=F7F7F7><td>";
if (a==1) desc += "Text 1";
if (a==2) desc += "Text 2";
if (a==3) desc += "Text 3";
if (a==4) desc += "Text 4";
if (a==5) desc += "Text 5";
desc += "</td></table>";
if(isNav) {
document.object1.document.write(desc);
document.object1.document.close();
document.object1.left=x+25;
document.object1.top=y;
} else {
object1.innerHTML=desc;
eval(dS+"object1"+sD+h+(x+25));
eval(dS+"object1"+sD+v+y);
}
}
function hideLayer(a) {
if(isNav) {
eval(document.object1.top=a);
}
else object1.innerHTML="";
}
function handlerMM(e) {
x = (isNav) ? e.pageX : event.clientX;
y = (isNav) ? e.pageY : event.clientY;
}
if (isNav) {
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
// End -->
</script>
</head>
<body OnLoad="setupDescriptions()">
<div id="object1" style="position:absolute; visibility:show; left:25px; top:-50px; z-index:2">
<p>layer hidden off the screen</p>
</div><a href="" onMouseOver="popLayer(1)" onMouseOut="hideLayer(-50)"><b>
<p align="center">Option 1</b></a> </p>
<p align="center"><b><a href="" onMouseOver="popLayer(2)" onMouseOut="hideLayer(-50)">Option 2</a> </b></p>
<p align="center"><b><a href="" onMouseOver="popLayer(3)" onMouseOut="hideLayer(-50)">Option 3</a> </b></p>
<p align="center"><b><a href="" onMouseOver="popLayer(4)" onMouseOut="hideLayer(-50)">Option 4</a> </b></p>
<p align="center"><b><a href="" onMouseOver="popLayer(5)" onMouseOut="hideLayer(-50)"><img src=""></a> </b></p>
</body>
</html>
Kommentar