Avatar billede drole Nybegynder
22. august 2006 - 21:40 Der er 17 kommentarer og
1 løsning

Hvordan indsætter jeg en variabel i et javascript?

Jeg tror overskrift siger det meget godt:

Nu vil jeg bare vi min kode:)


<script type="text/javascript">

//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="http://www.javascriptkit.com">JavaScript Kit</a>'
menu1[1]='<a href="http://www.freewarejava.com">Freewarejava.com</a>'
menu1[2]='<a href="http://codingforums.com">Coding Forums</a>'
menu1[3]='<a href="http://www.cssdrive.com">CSS Drive</a>'

</script>

og hvis jeg nu skal indsætte $r_menu1

<?
//ARTIKEL
$query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '2' and `folder` = '4' ORDER BY id DESC limit 1");
while($r_menu = mysql_fetch_array($query_menu)) {

$r_menu1 = $r_menu['url'];

} ?>



<?
Avatar billede drole Nybegynder
22. august 2006 - 21:40 #1
og det vil sige indsætte den istedet for de andre links
Avatar billede nielle Nybegynder
22. august 2006 - 21:45 #2
Hvad mener du med at den skal indsættes i stedet for de andre?

Et bud:

<?
//ARTIKEL
$query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '2' and `folder` = '4' ORDER BY id DESC limit 1");
while($r_menu = mysql_fetch_array($query_menu)) {

$r_menu1 = $r_menu['url'];

} ?>

<script type="text/javascript">
//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="http://www.javascriptkit.com">JavaScript Kit</a>'
menu1[1]='<a href="http://www.freewarejava.com">Freewarejava.com</a>'
menu1[2]='<a href="http://codingforums.com">Coding Forums</a>'
menu1[3]='<a href="http://www.cssdrive.com">CSS Drive</a>'
menu1[4]='<a href="<?=$r_menu1?>">CSS Drive</a>'
</script>
Avatar billede drole Nybegynder
22. august 2006 - 21:49 #3
det virker perfekt. Men måske kunne jeg spørger om et lile tillægsspørgsmål:) hvis det er nemt?

Hvis der nu er 2 mysql 'hits' hvordan laver jeg så en lignende funktion som while hvor man så automatisk bliver addet nye når der kommer hits:) hvis du forstår:

Eks.

Home - Oel
    - Oel2

Hvordan får jeg dem automatisk ind hvis nu der kommer en 'Oel3'
Avatar billede nielle Nybegynder
22. august 2006 - 21:52 #4
Jeg har lige et par spørgsmål:

1) Skal de lægge sbagefter de 4 eksisterende sådan som jeg har vist? Eller skal de erestatte dem?

2) Titlen for $r_menu1 linket er "CSS Drive". Den skulle vel være noget andet? Er det en oplysning du også har i din tabel?
Avatar billede drole Nybegynder
22. august 2006 - 21:54 #5
Det er en funktion ligesom 5 nyeste nyheder. Så når der kommer en ny skal den self øverst.

og der er 'overskrift' og 'id' som jeg skal bruge
Avatar billede nielle Nybegynder
22. august 2006 - 22:03 #6
Noget i denne stil?

<?
//ARTIKEL
$sql = "SELECT * FROM oelfam WHERE niveau='2' AND folder='4' ORDER BY id DESC LIMIT 5";
$query_menu = mysql_query($sql) or die(mysql_error());

echo "
<script type=\"text/javascript\">
//Contents for menu 1
var menu1=new Array()
";

$arrayIdx = 0;
while ($r_menu = mysql_fetch_array($query_menu))
{
    $url = $r_menu["url"];
    $titel = $r_menu["overskrift"];

    echo "menu1[$arrayIdx]='<a href=\"$url\">$titel</a>'\n";

}
?>

echo "</script>";
Avatar billede nielle Nybegynder
22. august 2006 - 22:04 #7
Hov, glemte liuge at tælle array-indekset op:

<?
//ARTIKEL
$sql = "SELECT * FROM oelfam WHERE niveau='2' AND folder='4' ORDER BY id DESC LIMIT 5";
$query_menu = mysql_query($sql) or die(mysql_error());

echo "
<script type=\"text/javascript\">
//Contents for menu 1
var menu1=new Array()
";

$arrayIdx = 0;
while ($r_menu = mysql_fetch_array($query_menu))
{
    $url = $r_menu["url"];
    $titel = $r_menu["overskrift"];

    echo "menu1[$arrayIdx]='<a href=\"$url\">$titel</a>'\n";

    $arrayIdx++;
}
?>

echo "</script>";
Avatar billede drole Nybegynder
22. august 2006 - 22:16 #8
hmm den siger der er fejl på siden. Jeg kan ikke helt forstå det. Jeg prøver lige at kopiere det hele ind.

Efter indsat:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
<? // MENU ?>
<style type="text/css">

#dropmenudiv{
position:absolute;
border:1px solid black;
border-bottom-width: 0;
font:normal 12px Verdana;
line-height:18px;
z-index:100;
}

#dropmenudiv a{
width: 100%;
display: block;
text-indent: 3px;
border-bottom: 1px solid black;
padding: 1px 0;
text-decoration: none;
font-weight: bold;
}

#dropmenudiv a:hover{ /*hover background color*/
background-color: grey;
}

</style>

<?
//ARTIKEL
$sql = "SELECT * FROM oelfam WHERE niveau='2' AND folder='4' ORDER BY id DESC LIMIT 5";
$query_menu = mysql_query($sql) or die(mysql_error());

echo '
<script type="text/javascript">
//Contents for menu 1
var menu1=new Array()
';

$arrayIdx = 0;
while ($r_menu = mysql_fetch_array($query_menu))
{
    $url = $r_menu["url"];
    $titel = $r_menu["overskrift"];

    echo "menu1[$arrayIdx]='<a href=\"$url\">$titel</a>'\n";

    $arrayIdx++;
}
?>

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

/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/



//Contents for menu 2, and so on
var menu2=new Array()
menu2[0]='<a href="http://cnn.com">CNN</a>'
menu2[1]='<a href="http://msnbc.com">MSNBC</a>'
menu2[2]='<a href="http://news.bbc.co.uk">BBC News</a>'
       
var menuwidth='165px' //default menu width
var menubgcolor='lightyellow'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

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

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)

dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

</script>
<? // MENU SLUT ?>
  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
  <meta name="description" content="Your description goes here" />
  <meta name="keywords" content="your,keywords,goes,here" />
  <meta name="author" content="Your Name / Original design: Gerhard Erbes - gw@actamail.com/" />
  <link rel="stylesheet" type="text/css" href="./css/style.css" />
  <title>Oelfam.com</title>
</head>

<body>
  <div id="wrap">

    <!-- HEADER -->
      <!-- Background -->
    <div id="header-section">
<?
$top = mysql_fetch_array(mysql_query("SELECT * FROM `oelfam_top` ORDER BY id DESC limit 1"));
$top2 = rand(1, $top['id']);
$top3 = mysql_fetch_array(mysql_query("SELECT * FROM `oelfam_top` WHERE `id` = '$top2'"));
?>
          <a href="#"><img id="header-background-left" src="./img/img_logo.png" alt=""/></a>
      <img id="header-background-right" src="<? echo $top3['url']; ?>" alt=""/>
        </div>

      <!-- Navigation -->
          <div id="header">
    <div align="center"><ul>
      <li><a href="?">Main</a></li>
<? //UPPER MENU ?>

<?
//ARTIKEL
$query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '2' and `folder` = '4' ORDER BY id DESC limit 1");
while($r_menu = mysql_fetch_array($query_menu)) { ?>
<li><a href="?visnyhed=1&id=<? echo $r_menu['id']; ?>" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu1, '150px')" onMouseout="delayhidemenu()">Nyeste Artikel</a></li>
<? }

//BIOGRAPHY
$query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '2' and `folder` = '4' ORDER BY id DESC limit 1");
while($r_menu = mysql_fetch_array($query_menu)) { ?>
<li><a href="?visnyhed=1&id=<? echo $r_menu['id']; ?>" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu2, '150px')" onMouseout="delayhidemenu()">Nyeste Artikel</a></li>
<? }

//WORD
$query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '2' and `folder` = '6' ORDER BY id DESC limit 1");
while($r_menu = mysql_fetch_array($query_menu)) {
if($_GET['visnyhed'] == 1 and $_GET['id'] == $r_menu['id']){?>
<li class="selected">Nyeste Ord</li><? }else{ ?>
<li><a href="?visnyhed=1&id=<? echo $r_menu['id']; ?>">Nyeste Ord</a></li><? } }

//MEDIA
$query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '2' and `folder` = '7' ORDER BY id DESC limit 1");
while($r_menu = mysql_fetch_array($query_menu)) {
if($_GET['visnyhed'] == 1 and $_GET['id'] == $r_menu['id']){?>
<li class="selected">Nyeste Fil</li><? }else{ ?>
<li><a href="?visnyhed=1&id=<? echo $r_menu['id']; ?>">Nyeste Fil</a></li><? } }

//EKSPERTRÅD
$query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '2' and `folder` = '471' ORDER BY id DESC limit 1");
while($r_menu = mysql_fetch_array($query_menu)) {
if($_GET['visnyhed'] == 1 and $_GET['id'] == $r_menu['id']){?>
<li class="selected">Nyeste Råd</li><? }else{ ?>
<li><a href="?visnyhed=1&id=<? echo $r_menu['id']; ?>">Nyeste Råd</a></li><? } }

//PROFIL
$query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '2' and `folder` = '144' ORDER BY id DESC limit 1");
while($r_menu = mysql_fetch_array($query_menu)) {
if($_GET['visnyhed'] == 1 and $_GET['id'] == $r_menu['id']){?>
<li class="selected">Nyeste Profil</li><? }else{ ?>
<li><a href="?visnyhed=1&id=<? echo $r_menu['id']; ?>">Nyeste Profil</a></li><? } }



//UPPER MENU SLUT ?>
      </ul></div>
    </div>

      <!-- LEFT COLUMN -->
      <!-- Navigation -->
    <div id="left-column">
      <ul>
<? //MENU 1 ?>   
<li class="left-navheader-first">Menu</li> 
<?      $query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '0' and `type` = 1 and `id` != '12' and `id` != '13' and `id` != '14' ORDER BY prioritet ASC");
echo mysql_error();

while($r_menu = mysql_fetch_array($query_menu)) {
$id_menu = $r_menu['id'];
$overskrift_menu = $r_menu['overskrift'];
$indhold_menu = $r_menu['indhold'];
$kode_menu = $r_menu['kode'];
?>
        <li><a class="left-navheader" href="?"><big>Home</big><i>(at Oels)</i></a></li>
<?
//KODER!!!
echo $indhold_menu;
eval($kode_menu);
if($_SESSION['loggedind'] == "ok"){
$query_menu2 = mysql_query("SELECT * FROM `oelfam` WHERE `folder` = '140' or `id` = '144' or `folder` = '$id_menu' ORDER BY prioritet ASC");
}else{
$query_menu2 = mysql_query("SELECT * FROM `oelfam` WHERE `folder` = '$id_menu' or `id` = '144' ORDER BY overskrift ASC");
}
echo mysql_error();
while($r_menu2 = mysql_fetch_array($query_menu2)) {
$id_menu2 = $r_menu2['id'];
$overskrift_menu2 = $r_menu2['overskrift'];
$indhold_menu2 = $r_menu2['indhold'];
$manchet_menu2 = $r_menu2['manchet'];
$type_menu2 = $r_menu2['type'];
if($id_menu2 == $_GET['id'] && $_GET['niveau'] == '1'){?>
<li class="selected"><? echo $overskrift_menu2; ?><small><em><? if($manchet_menu2){?>(<? echo $manchet_menu2; ?>)<? } ?></em></small></li>
<? }else{
if($id_menu2 == 396 or $id_menu2 == 2){}else{
?>

    <li><a href="<? echo '?niveau=1&id=' . $id_menu2 . '&type=' . $type_menu2; ?>"><? echo $overskrift_menu2; ?><small><em><? if($manchet_menu2){?>(<? echo $manchet_menu2; ?>)<? } ?></em></small></a></li>


<? } } }
} ?>
      </ul>
    </div>

      <!-- RIGHT COLUMN -->
    <div id="right-column">
<?
if($_SESSION['loggedind'] == "ok"){
$query_nyhed = mysql_query("SELECT * FROM `oelfam` WHERE `id` =  '142' or `id` = '12' or `id` = 140 ORDER BY prioritet asc");
}else{
$query_nyhed = mysql_query("SELECT * FROM `oelfam` WHERE `id` =  '142' or `id` = '12' or `id` = 140 ORDER BY prioritet asc");
}
while($r_nyhed1 = mysql_fetch_array($query_nyhed)) {
?>

   
<? if($r_nyhed1['farve'] == 'ww'){?> <div class="right-column-box-white"><div class="right-column-box-title-grey"><?
}elseif($r_nyhed1['farve'] == 'bw'){?> <div class="right-column-box-white"><div class="right-column-box-title-blue"><?
}elseif($r_nyhed1['farve'] == 'bb'){?> <div class="right-column-box-blue"><div class="right-column-box-title-blue"><?
}elseif($r_nyhed1['farve'] == 'gw'){?> <div class="right-column-box-white"><div class="right-column-box-title-green"><?
}elseif($r_nyhed1['farve'] == 'gg'){?> <div class="right-column-box-green"><div class="right-column-box-title-green"><?
}elseif($r_nyhed1['farve'] == 'rw'){?> <div class="right-column-box-white"><div class="right-column-box-title-red"><?
}elseif($r_nyhed1['farve'] == 'rr'){?> <div class="right-column-box-red"><div class="right-column-box-title-red"><?
}elseif($r_nyhed1['farve'] == 'yw'){?> <div class="right-column-box-white"><div class="right-column-box-title-yellow"><?
}elseif($r_nyhed1['farve'] == 'yy'){?> <div class="right-column-box-yellow"><div class="right-column-box-title-yellow"><?
}else{?> <div class="right-column-box-white"><div class="right-column-box-title-grey"><? } ?>
<? echo $r_nyhed1['overskrift']; ?></div>
<? echo $r_nyhed1['indhold'];
eval($r_nyhed1['kode']); ?>
      </div>
<? } ?>
</div>
Avatar billede drole Nybegynder
22. august 2006 - 22:17 #9
før:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
<? // MENU ?>
<style type="text/css">

#dropmenudiv{
position:absolute;
border:1px solid black;
border-bottom-width: 0;
font:normal 12px Verdana;
line-height:18px;
z-index:100;
}

#dropmenudiv a{
width: 100%;
display: block;
text-indent: 3px;
border-bottom: 1px solid black;
padding: 1px 0;
text-decoration: none;
font-weight: bold;
}

#dropmenudiv a:hover{ /*hover background color*/
background-color: grey;
}

</style>



<script type="text/javascript">

/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="?visnyhed=1&id=<?=$top_menu_id11?>"><?=$top_menu_overskrift11?></a>'
menu1[0]='<a href="?visnyhed=1&id=<?=$top_menu_id12?>"><?=$top_menu_overskrift12?></a>'
menu1[2]='<a href="http://codingforums.com">Coding Forums</a>'
menu1[3]='<a href="http://www.cssdrive.com">CSS Drive</a>'

//Contents for menu 2, and so on
var menu2=new Array()
menu2[0]='<a href="http://cnn.com">CNN</a>'
menu2[1]='<a href="http://msnbc.com">MSNBC</a>'
menu2[2]='<a href="http://news.bbc.co.uk">BBC News</a>'
       
var menuwidth='165px' //default menu width
var menubgcolor='lightyellow'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

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

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)

dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

</script>
<? // MENU SLUT ?>
  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
  <meta name="description" content="Your description goes here" />
  <meta name="keywords" content="your,keywords,goes,here" />
  <meta name="author" content="Your Name / Original design: Gerhard Erbes - gw@actamail.com/" />
  <link rel="stylesheet" type="text/css" href="./css/style.css" />
  <title>Oelfam.com</title>
</head>

<body>
  <div id="wrap">

    <!-- HEADER -->
      <!-- Background -->
    <div id="header-section">
<?
$top = mysql_fetch_array(mysql_query("SELECT * FROM `oelfam_top` ORDER BY id DESC limit 1"));
$top2 = rand(1, $top['id']);
$top3 = mysql_fetch_array(mysql_query("SELECT * FROM `oelfam_top` WHERE `id` = '$top2'"));
?>
          <a href="#"><img id="header-background-left" src="./img/img_logo.png" alt=""/></a>
      <img id="header-background-right" src="<? echo $top3['url']; ?>" alt=""/>
        </div>

      <!-- Navigation -->
          <div id="header">
    <div align="center"><ul>
      <li><a href="?">Main</a></li>
<? //UPPER MENU ?>

<?
//ARTIKEL
$query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '2' and `folder` = '4' ORDER BY id DESC limit 1");
while($r_menu = mysql_fetch_array($query_menu)) { ?>
<li><a href="?visnyhed=1&id=<? echo $r_menu['id']; ?>" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu1, '150px')" onMouseout="delayhidemenu()">Nyeste Artikel</a></li>
<? }

//BIOGRAPHY
$query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '2' and `folder` = '4' ORDER BY id DESC limit 1");
while($r_menu = mysql_fetch_array($query_menu)) { ?>
<li><a href="?visnyhed=1&id=<? echo $r_menu['id']; ?>" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu2, '150px')" onMouseout="delayhidemenu()">Nyeste Artikel</a></li>
<? }

//WORD
$query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '2' and `folder` = '6' ORDER BY id DESC limit 1");
while($r_menu = mysql_fetch_array($query_menu)) {
if($_GET['visnyhed'] == 1 and $_GET['id'] == $r_menu['id']){?>
<li class="selected">Nyeste Ord</li><? }else{ ?>
<li><a href="?visnyhed=1&id=<? echo $r_menu['id']; ?>">Nyeste Ord</a></li><? } }

//MEDIA
$query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '2' and `folder` = '7' ORDER BY id DESC limit 1");
while($r_menu = mysql_fetch_array($query_menu)) {
if($_GET['visnyhed'] == 1 and $_GET['id'] == $r_menu['id']){?>
<li class="selected">Nyeste Fil</li><? }else{ ?>
<li><a href="?visnyhed=1&id=<? echo $r_menu['id']; ?>">Nyeste Fil</a></li><? } }

//EKSPERTRÅD
$query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '2' and `folder` = '471' ORDER BY id DESC limit 1");
while($r_menu = mysql_fetch_array($query_menu)) {
if($_GET['visnyhed'] == 1 and $_GET['id'] == $r_menu['id']){?>
<li class="selected">Nyeste Råd</li><? }else{ ?>
<li><a href="?visnyhed=1&id=<? echo $r_menu['id']; ?>">Nyeste Råd</a></li><? } }

//PROFIL
$query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '2' and `folder` = '144' ORDER BY id DESC limit 1");
while($r_menu = mysql_fetch_array($query_menu)) {
if($_GET['visnyhed'] == 1 and $_GET['id'] == $r_menu['id']){?>
<li class="selected">Nyeste Profil</li><? }else{ ?>
<li><a href="?visnyhed=1&id=<? echo $r_menu['id']; ?>">Nyeste Profil</a></li><? } }



//UPPER MENU SLUT ?>
      </ul></div>
    </div>

      <!-- LEFT COLUMN -->
      <!-- Navigation -->
    <div id="left-column">
      <ul>
<? //MENU 1 ?>   
<li class="left-navheader-first">Menu</li> 
<?      $query_menu = mysql_query("SELECT * FROM `oelfam` WHERE `niveau` = '0' and `type` = 1 and `id` != '12' and `id` != '13' and `id` != '14' ORDER BY prioritet ASC");
echo mysql_error();

while($r_menu = mysql_fetch_array($query_menu)) {
$id_menu = $r_menu['id'];
$overskrift_menu = $r_menu['overskrift'];
$indhold_menu = $r_menu['indhold'];
$kode_menu = $r_menu['kode'];
?>
        <li><a class="left-navheader" href="?"><big>Home</big><i>(at Oels)</i></a></li>
<?
//KODER!!!
echo $indhold_menu;
eval($kode_menu);
if($_SESSION['loggedind'] == "ok"){
$query_menu2 = mysql_query("SELECT * FROM `oelfam` WHERE `folder` = '140' or `id` = '144' or `folder` = '$id_menu' ORDER BY prioritet ASC");
}else{
$query_menu2 = mysql_query("SELECT * FROM `oelfam` WHERE `folder` = '$id_menu' or `id` = '144' ORDER BY overskrift ASC");
}
echo mysql_error();
while($r_menu2 = mysql_fetch_array($query_menu2)) {
$id_menu2 = $r_menu2['id'];
$overskrift_menu2 = $r_menu2['overskrift'];
$indhold_menu2 = $r_menu2['indhold'];
$manchet_menu2 = $r_menu2['manchet'];
$type_menu2 = $r_menu2['type'];
if($id_menu2 == $_GET['id'] && $_GET['niveau'] == '1'){?>
<li class="selected"><? echo $overskrift_menu2; ?><small><em><? if($manchet_menu2){?>(<? echo $manchet_menu2; ?>)<? } ?></em></small></li>
<? }else{
if($id_menu2 == 396 or $id_menu2 == 2){}else{
?>

    <li><a href="<? echo '?niveau=1&id=' . $id_menu2 . '&type=' . $type_menu2; ?>"><? echo $overskrift_menu2; ?><small><em><? if($manchet_menu2){?>(<? echo $manchet_menu2; ?>)<? } ?></em></small></a></li>


<? } } }
} ?>
      </ul>
    </div>

      <!-- RIGHT COLUMN -->
    <div id="right-column">
<?
if($_SESSION['loggedind'] == "ok"){
$query_nyhed = mysql_query("SELECT * FROM `oelfam` WHERE `id` =  '142' or `id` = '12' or `id` = 140 ORDER BY prioritet asc");
}else{
$query_nyhed = mysql_query("SELECT * FROM `oelfam` WHERE `id` =  '142' or `id` = '12' or `id` = 140 ORDER BY prioritet asc");
}
while($r_nyhed1 = mysql_fetch_array($query_nyhed)) {
?>

   
<? if($r_nyhed1['farve'] == 'ww'){?> <div class="right-column-box-white"><div class="right-column-box-title-grey"><?
}elseif($r_nyhed1['farve'] == 'bw'){?> <div class="right-column-box-white"><div class="right-column-box-title-blue"><?
}elseif($r_nyhed1['farve'] == 'bb'){?> <div class="right-column-box-blue"><div class="right-column-box-title-blue"><?
}elseif($r_nyhed1['farve'] == 'gw'){?> <div class="right-column-box-white"><div class="right-column-box-title-green"><?
}elseif($r_nyhed1['farve'] == 'gg'){?> <div class="right-column-box-green"><div class="right-column-box-title-green"><?
}elseif($r_nyhed1['farve'] == 'rw'){?> <div class="right-column-box-white"><div class="right-column-box-title-red"><?
}elseif($r_nyhed1['farve'] == 'rr'){?> <div class="right-column-box-red"><div class="right-column-box-title-red"><?
}elseif($r_nyhed1['farve'] == 'yw'){?> <div class="right-column-box-white"><div class="right-column-box-title-yellow"><?
}elseif($r_nyhed1['farve'] == 'yy'){?> <div class="right-column-box-yellow"><div class="right-column-box-title-yellow"><?
}else{?> <div class="right-column-box-white"><div class="right-column-box-title-grey"><? } ?>
<? echo $r_nyhed1['overskrift']; ?></div>
<? echo $r_nyhed1['indhold'];
eval($r_nyhed1['kode']); ?>
      </div>
<? } ?>
</div>
Avatar billede drole Nybegynder
22. august 2006 - 22:17 #10
Der man skal fokusere er ved //ARTIKEL det er menuen og toppen
Avatar billede nielle Nybegynder
22. august 2006 - 22:18 #11
Jeg kunne godt ønske mig at du også lavede en Vis Kilde af siden, og postede den.
Avatar billede drole Nybegynder
22. august 2006 - 22:21 #12
www.oelfam.com/new/

Her er den. det er menuerne i toppen vi arbejder med
Avatar billede nielle Nybegynder
22. august 2006 - 22:30 #13
Jeg synes ikke at den postede kode fra 22/08-2006 22:16:44 stemmer overens med det som jeg kan se på dit link.

Hele denne blok:

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

/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

- mangler f.eks. imellem menu1 og menu2.
Avatar billede drole Nybegynder
22. august 2006 - 22:35 #14
jeg har ikke slettet noget?
Avatar billede drole Nybegynder
22. august 2006 - 22:36 #15
Jeg sidder og arbejder med den nu og prøver at finde fejlkilder. Så måske er det derfor?
Avatar billede nielle Nybegynder
22. august 2006 - 22:40 #16
Muligvis ... lige nu kan jeg selt ikke finde dem overhovedet.
Avatar billede drole Nybegynder
22. august 2006 - 22:40 #17
ej ved du hvad? Send et svar så acceptere jeg det. du har gjort nok:) tak for det er meget taknemmelig
Avatar billede nielle Nybegynder
22. august 2006 - 22:42 #18
Jeg lægger da gerne et svar, men du er velkommen til at spørge videre. :^)
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