Indsætte javascript.
Hejsa jeg er ved at prøve at sætte et java script ind i min php index side, men det virker ikke, eller det er sikkert mig der gør det forkert, her er min index :<?php
/************************************************************************/
/* PHP-NUKE: Advanced Content Management System */
/* ============================================ */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
require_once("mainfile.php");
$_SERVER['PHP_SELF'] = "modules.php";
$sql = "SELECT main_module from ".$prefix."_main";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$name = $row[main_module];
$home = 1;
if ($httpref==1) {
$referer = $_SERVER["HTTP_REFERER"];
$referer = check_html($referer, nohtml);
if ($referer=="" OR eregi("^unknown", $referer) OR substr("$referer",0,strlen($nukeurl))==$nukeurl OR eregi("^bookmark",$referer)) {
} else {
$sql = "INSERT INTO ".$prefix."_referer VALUES (NULL, '$referer')";
$result = $db->sql_query($sql);
}
$sql = "SELECT * FROM ".$prefix."_referer";
$result = $db->sql_query($sql);
$numrows = $db->sql_numrows($result);
if($numrows>=$httprefmax) {
$sql = "DELETE FROM ".$prefix."_referer";
$result = $db->sql_query($sql);
}
}
if (!isset($mop)) { $mop="modload"; }
if (!isset($mod_file)) { $mod_file="index"; }
if (ereg("\.\.",$name) || ereg("\.\.",$file) || ereg("\.\.",$mod_file) || ereg("\.\.",$mop)) {
echo "You are so cool...";
} else {
$ThemeSel = get_theme();
if (file_exists("themes/$ThemeSel/module.php")) {
include("themes/$ThemeSel/module.php");
if (is_active("$default_module") AND file_exists("modules/$default_module/$mod_file.php")) {
$name = $default_module;
}
}
if (file_exists("themes/$ThemeSel/modules/$name/$mod_file.php")) {
$modpath = "themes/$ThemeSel/";
}
$modpath .= "modules/$name/$mod_file.php";
if (file_exists($modpath)) {
include($modpath);
} else {
$index = 1;
include("header.php");
OpenTable();
if (is_admin($admin)) {
echo "<center><font class=\"\"><b>"._HOMEPROBLEM."</b></font><br><br>[ <a href=\"admin.php?op=modules\">"._ADDAHOME."</a> ]</center>";
} else {
echo "<center>"._HOMEPROBLEMUSER."</center>";
}
CloseTable();
include("footer.php");
}
}
?>
og her er mit java script :
<style type="text/css">
<!--
#sponsorAdDiv {position:absolute; height:1; width:1; top:0; left:0;}
-->
</style>
<SCRIPT LANGUAGE="JavaScript1.2">
adTime=10; // seconds ad reminder is shown
chanceAd=1; // ad will be shown 1 in X times (put 1 for everytime)
var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);
adCount=0;
function initAd(){
if(!ns && !ie && !w3) return;
if(ie) adDiv=eval('document.all.sponsorAdDiv.style');
else if(ns) adDiv=eval('document.layers["sponsorAdDiv"]');
else if(w3) adDiv=eval('document.getElementById("sponsorAdDiv").style');
randAd=Math.ceil(Math.random()*chanceAd);
if (ie||w3)
adDiv.visibility="visible";
else
adDiv.visibility ="show";
if(randAd==1) showAd();
}
function showAd(){
if(adCount<adTime*10){adCount+=1;
if (ie){documentWidth =document.body.offsetWidth/2+document.body.scrollLeft-20;
documentHeight =document.body.offsetHeight/2+document.body.scrollTop-20;}
else if (ns){documentWidth=window.innerWidth/2+window.pageXOffset-20;
documentHeight=window.innerHeight/2+window.pageYOffset-20;}
else if (w3){documentWidth=self.innerWidth/2+window.pageXOffset-20;
documentHeight=self.innerHeight/2+window.pageYOffset-20;}
adDiv.left=documentWidth-200;adDiv.top =documentHeight-200;
setTimeout("showAd()",100);}else closeAd();
}
function closeAd(){
if (ie||w3)
adDiv.display="none";
else
adDiv.visibility ="hide";
}
onload=initAd;
//End-->
</script>
</head>
<body>
<div id="sponsorAdDiv" style="visibility:hidden">
<table width="450" height="350" bgcolor="#000000"><tr><td>
<table width="445" height="345" bgcolor="#000000"><tr><td align="center" valign="middle">
<!--*****EDIT THIS MESSAGE*****-->
<script type="text/javascript" src="http://dk.danban.com/ad/93b9f815f3d1f24060bb41124628b503"></script>
Støt os - besøg en af vores sponsore<br> Mvh Dkscripts.tk</b>
<a target="_blank" href="http://linkburst.com/r-184402"><img src="http://linkburst.com/banner1.gif" width="468" height="60" border="0"></a>
</p>
<br>
<!--*****EDIT THE ABOVE MESSAGE*****-->
</td></tr></table></td></tr></table>
</div>
dette er et lille reklame vindue der lukker efter 5 sek igen. men er der en der kan sætte dette samme så det virker ville jeg blive meget glad :-)