我在线使用WordPress,而且我是一名经验丰富的程序员。试图在一侧嵌入一个js-script,它应该产生以下一行:
IdagärdetOnsdag,den 02 November 2016 och Tobias har namnsdag。
我的问题是,脚本NamedayHandler.js
生成的名称 Tobias 未显示。问题是该脚本位于另一个目录中。
我尝试嵌入的脚本是:
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Win">
<BASE TARGET="_top">
<TITLE></TITLE>
<META NAME="description" CONTENT="Eivor och Bengt Ohlsson's hemsida">
<META NAME="keywords" CONTENT="bengt,eivor,ohlsson,resor,turism,kultur,sol,bad,resa,radar">
<script type="text/javascript" src="eivorobengt.se/NamedayHandler.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD>
<script type="text/javascript">
window.onload = function() {
new NamedayHandler({elm: 'namnsdag'});
}
</script>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Author: www.cgiscript.net -->
<!-- Begin
// Get today's current date.
var now = new Date();
// Array list of days.
var days = new Array('Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag');
// Array list of months.
var months = new Array('Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December');
// Calculate the number of the current day in the week.
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
// Calculate four digit year.
function fourdigits(number) {
return (number < 1000) ? number + 1900 : number;
}
// Join it all together
today = "Idag är det " +
days[now.getDay()] + ", " +"den " +
date + " " +
months[now.getMonth()] + " " +
(fourdigits(now.getYear())) + " och" ;
// Print out the data.
document.write (today);
// End -->
</script>
<script type="text/javascript src="NamedayHandler.js"></script>
<span id="namnsdag"></span> har namnsdag.</FONT> </p>
</BODY>
</HTML>
这给出了以下错误:
“ReferenceError:未定义eivorobengt”。
我该怎么办?