Avatar billede iceworld.tk Nybegynder
29. juli 2002 - 14:02 Der er 2 kommentarer og
1 løsning

Centre dette , hvordan ?

jeg har denne kode til en menu men den skal centreres (så menuen kommer i midtien)
Hvordan gør jeg ?



------------------------------------------------------


<html>
<head>

<style type="text/css">
h1 {
color:#000000;
font-family:verdana;
font-size:36px;
text-decoration:none;
}
.underlink {
color:#3333AA;
font-family:verdana;
font-size:12px;
text-decoration:none;
}
.undercelle {
background-color:#ccccdd;
text-align:center;
border-top:1px solid #555555;
}
.undertable {
border-right:1px solid #555555;
border-left:1px solid #555555;
border-bottom:1px solid #555555;
}
.link {
color:#3333AA;
font-family:verdana;
font-size:12px;
text-decoration:none;
}
.maincelle {
background-color:#e9e9e9;
text-align:center;
border-left:1px solid #555555;
}
.maintable {
border-right:1px solid #555555;
border-top:1px solid #555555;
border-bottom:1px solid #555555;
}
</style>

<script type="text/javascript" language="javascript">

skjuletid = 300

var Ymouse = Xmouse = 0;
var ns4 = (document.layers)?true:false;
var ns6 = (document.getElementById && !document.all)?true:false;

function Mouse( evnt ) {
  Ymouse=(ns4||ns6)?evnt.pageY:event.y;
  Xmouse=(ns4||ns6)?evnt.pageX:event.x;
};

if (ns4) {
  window.captureEvents(Event.MOUSEMOVE);
  window.onMouseMove=Mouse;        // NS
} else {
  document.onmousemove=Mouse;      // IE
};
var over = false
function varchr(){
over = true;
}

var memobj = "start"
function gaaigang(obj){
    if (over) {}
    else{
skjul(memobj);
memobj = obj;
vis(obj);
over = true;
    }
}
function vis(obj){
if (document.getElementById){sabine = eval("document.getElementById('"+obj+"').style");}
else if (document.all){sabine = eval("document.all."+obj+".style");}
else {sabine = eval("document."+obj+".style");}

if (ns6){sabine.display="";}
else {
sabine.visibility = "visible";
}
    if (over){}
    else {
    sabine.left = Xmouse - 30
    sabine.top = Ymouse + 1}
}
function skjul(obj){
    if (over){}
    else {
if (document.getElementById){sabine = eval("document.getElementById('"+obj+"').style");}
else if (document.all){sabine = eval("document.all."+obj+".style");}
else {sabine = eval("document."+obj+".style");}

if (ns6){sabine.display="";}
else {
sabine.visibility = "hidden";
}
    }

}
function slut(obj){
temp = obj
over = false
tiden = window.setTimeout("skjul(temp);",skjuletid);

}


function ulrik(element,mode) {
    if (mode=="in") {
      cursortype = 'hand'
      colorval = '#B7C6D6'
    } else if (mode=="out") {
      cursortype = ''
      colorval = '#e9e9e9'
    }
element.style.background=colorval;
element.style.cursor=cursortype;
}
function ulrik2(element,mode) {
    if (mode=="in") {
      cursortype = 'hand'
      colorval = '#f0f0f0'
    } else if (mode=="out") {
      cursortype = ''
      colorval = '#ccccdd'
    }
element.style.background=colorval;
element.style.cursor=cursortype;
}

</script>

<title>Iceworld.tk menu</title>

</head>
<body onload="skjul('layer1');skjul('layer2');">
<hr size="2" noshade width="100%" color="#000000">

<table cellpadding="0" cellspacing="0" width="250" class="maintable">
<tr>
<td class="maincelle" onmouseover="gaaigang('layer1');ulrik(this, 'in');" onmouseout="slut('layer1');ulrik(this, 'out');">
<a class="link" href="#" onclick="gaaigang('layer1');return false">Menu</a>
</td><td class="maincelle" onmouseover="gaaigang('layer2');ulrik(this, 'in');" onmouseout="slut('layer2');ulrik(this, 'out');">
<a class="link" href="#" onclick="gaaigang('layer2');return false">Contact</a>
</td>
</table>

<div style="position:absolute;center:300px;top:300px;" id="layer1" onmouseover="varchr()" onmouseout="slut('layer1')">
<table cellpadding="0" cellspacing="0" width="150" class="undertable">
<tr>
<td class="undercelle" onmouseover="ulrik2(this, 'in');" onmouseout="ulrik2(this, 'out');">
<a class="underlink" href="http://home1.stofanet.dk/commander/Links.htm">Links</a>
</td></tr>
<tr><td class="undercelle" onmouseover="ulrik2(this, 'in');" onmouseout="ulrik2(this, 'out');">
<a class="underlink" href="http://home1.stofanet.dk/commander/Downloads.htm">Downloads</a>
</td></tr>
<tr><td class="undercelle" onmouseover="ulrik2(this, 'in');" onmouseout="ulrik2(this, 'out');">
<a class="underlink" href="http://home1.stofanet.dk/commander/News.htm">News</a>

</table>
</div>

<div style="position:absolute;center:300px;top:300px;" id="layer2" onmouseover="varchr()" onmouseout="slut('layer2')">
<table cellpadding="0" cellspacing="0" width="150" class="undertable">
<tr>
<td class="undercelle" onmouseover="ulrik2(this, 'in');" onmouseout="ulrik2(this, 'out');">
<a class="underlink" href="mailto:dskytte@stofanet.dk">Mail admin</a>
</table>
</div>
<div style="position:absolute;center:-300px;top:-300px;width:5px;height:5;" id="start" onmouseover="varchr()">
</div>


</body>
</html>

----------------------------------------------
Avatar billede gryn Nybegynder
29. juli 2002 - 14:09 #1
Du skal bare sætte align="center" på tabellen:


<html>
<head>

<style type="text/css">
h1 {
color:#000000;
font-family:verdana;
font-size:36px;
text-decoration:none;
}
.underlink {
color:#3333AA;
font-family:verdana;
font-size:12px;
text-decoration:none;
}
.undercelle {
background-color:#ccccdd;
text-align:center;
border-top:1px solid #555555;
}
.undertable {
border-right:1px solid #555555;
border-left:1px solid #555555;
border-bottom:1px solid #555555;
}
.link {
color:#3333AA;
font-family:verdana;
font-size:12px;
text-decoration:none;
}
.maincelle {
background-color:#e9e9e9;
text-align:center;
border-left:1px solid #555555;
}
.maintable {
border-right:1px solid #555555;
border-top:1px solid #555555;
border-bottom:1px solid #555555;
}
</style>

<script type="text/javascript" language="javascript">

skjuletid = 300

var Ymouse = Xmouse = 0;
var ns4 = (document.layers)?true:false;
var ns6 = (document.getElementById && !document.all)?true:false;

function Mouse( evnt ) {
  Ymouse=(ns4||ns6)?evnt.pageY:event.y;
  Xmouse=(ns4||ns6)?evnt.pageX:event.x;
};

if (ns4) {
  window.captureEvents(Event.MOUSEMOVE);
  window.onMouseMove=Mouse;        // NS
} else {
  document.onmousemove=Mouse;      // IE
};
var over = false
function varchr(){
over = true;
}

var memobj = "start"
function gaaigang(obj){
    if (over) {}
    else{
skjul(memobj);
memobj = obj;
vis(obj);
over = true;
    }
}
function vis(obj){
if (document.getElementById){sabine = eval("document.getElementById('"+obj+"').style");}
else if (document.all){sabine = eval("document.all."+obj+".style");}
else {sabine = eval("document."+obj+".style");}

if (ns6){sabine.display="";}
else {
sabine.visibility = "visible";
}
    if (over){}
    else {
    sabine.left = Xmouse - 30
    sabine.top = Ymouse + 1}
}
function skjul(obj){
    if (over){}
    else {
if (document.getElementById){sabine = eval("document.getElementById('"+obj+"').style");}
else if (document.all){sabine = eval("document.all."+obj+".style");}
else {sabine = eval("document."+obj+".style");}

if (ns6){sabine.display="";}
else {
sabine.visibility = "hidden";
}
    }

}
function slut(obj){
temp = obj
over = false
tiden = window.setTimeout("skjul(temp);",skjuletid);

}


function ulrik(element,mode) {
    if (mode=="in") {
      cursortype = 'hand'
      colorval = '#B7C6D6'
    } else if (mode=="out") {
      cursortype = ''
      colorval = '#e9e9e9'
    }
element.style.background=colorval;
element.style.cursor=cursortype;
}
function ulrik2(element,mode) {
    if (mode=="in") {
      cursortype = 'hand'
      colorval = '#f0f0f0'
    } else if (mode=="out") {
      cursortype = ''
      colorval = '#ccccdd'
    }
element.style.background=colorval;
element.style.cursor=cursortype;
}

</script>

<title>Iceworld.tk menu</title>

</head>
<body onload="skjul('layer1');skjul('layer2');">
<hr size="2" noshade width="100%" color="#000000">

<table cellpadding="0" cellspacing="0" width="250" class="maintable" align="center">
<tr>
<td class="maincelle" onmouseover="gaaigang('layer1');ulrik(this, 'in');" onmouseout="slut('layer1');ulrik(this, 'out');">
<a class="link" href="#" onclick="gaaigang('layer1');return false">Menu</a>
</td><td class="maincelle" onmouseover="gaaigang('layer2');ulrik(this, 'in');" onmouseout="slut('layer2');ulrik(this, 'out');">
<a class="link" href="#" onclick="gaaigang('layer2');return false">Contact</a>
</td>
</table>

<div style="position:absolute;center:300px;top:300px;" id="layer1" onmouseover="varchr()" onmouseout="slut('layer1')">
<table cellpadding="0" cellspacing="0" width="150" class="undertable">
<tr>
<td class="undercelle" onmouseover="ulrik2(this, 'in');" onmouseout="ulrik2(this, 'out');">
<a class="underlink" href="http://home1.stofanet.dk/commander/Links.htm">Links</a>
</td></tr>
<tr><td class="undercelle" onmouseover="ulrik2(this, 'in');" onmouseout="ulrik2(this, 'out');">
<a class="underlink" href="http://home1.stofanet.dk/commander/Downloads.htm">Downloads</a>
</td></tr>
<tr><td class="undercelle" onmouseover="ulrik2(this, 'in');" onmouseout="ulrik2(this, 'out');">
<a class="underlink" href="http://home1.stofanet.dk/commander/News.htm">News</a>

</table>
</div>

<div style="position:absolute;center:300px;top:300px;" id="layer2" onmouseover="varchr()" onmouseout="slut('layer2')">
<table cellpadding="0" cellspacing="0" width="150" class="undertable">
<tr>
<td class="undercelle" onmouseover="ulrik2(this, 'in');" onmouseout="ulrik2(this, 'out');">
<a class="underlink" href="mailto:dskytte@stofanet.dk">Mail admin</a>
</table>
</div>
<div style="position:absolute;center:-300px;top:-300px;width:5px;height:5;" id="start" onmouseover="varchr()">
</div>


</body>
</html>
Avatar billede iceworld.tk Nybegynder
29. juli 2002 - 14:12 #2
hvordan fjerne jeg så den "streg" der kommer ?
Avatar billede gryn Nybegynder
29. juli 2002 - 14:14 #3
Du fjerner:

<hr size="2" noshade width="100%" color="#000000">

lige i starten af <body>
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester