Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #21040
| From | Swifty <steve.j.swift@gmail.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Passing parameter to external script |
| Date | 2013-08-24 09:46 +0100 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <kv9rtr$ccu$1@speranza.aioe.org> (permalink) |
Can the construct:
<SCRIPT SRC=/lastupdated.js></SCRIPT>
… be modified to pass a parameter to lastused.js ?
I suspect the answer is "No", but since I rank last but three in
JavaScript coding skill (global survey) I decided to ask people who know.
Presumably, the answer is to define a function, lastupdated() in
lastupdated.js and then use:
<SCRIPT>lastupdated('Swifty')</SCRIPT>
inline the HTML?
Out of curiosity, are there any ghastly errors in my lastused.js,
bearing in mind that it works for me?
// Swifty's lastused.js
function LastUpdated(Whom)
{
if (Whom === undefined) {Whom = "Swifty";}
var DayOfWeek = new Initialize("Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday" );
var MonthName = new Initialize("January", "February", "March", "April",
"May", "June", "July", "August", "September", "October", "November",
"December");
var LastModifiedDate = new Date(document.lastModified);
document.write("<SMALL>This page was last updated ");
document.write(DayOfWeek[(LastModifiedDate.getDay() + 1 )] ,", ");
document.write(MonthName[(LastModifiedDate.getMonth() + 1)] ," ");
year=LastModifiedDate.getYear();
if (year<100) year+=100;
if (year<1000) year+=1900;
document.write( LastModifiedDate.getDate() ,", " ,( year ) );
hours= LastModifiedDate.getHours();
document.write( " at ", ((hours < 10) ? "0" : "") + hours )
minutes= LastModifiedDate.getMinutes();
document.write( ((minutes < 10) ? ":0" : ":") + minutes );
if (Whom !== '') {document.write(" by ",Whom,".");}
}
function Initialize()
{ this.length = Initialize.arguments.length
for ( var i = 0; i < this.length; i++ ) this[ i + 1 ] =
Initialize.arguments[ i ]
}
--
Steve Swift
http://www.swiftys.org.uk/
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
Passing parameter to external script Swifty <steve.j.swift@gmail.com> - 2013-08-24 09:46 +0100
Re: Passing parameter to external script Swifty <steve.j.swift@gmail.com> - 2013-08-24 09:54 +0100
Re: Passing parameter to external script Martin Honnen <mahotrash@yahoo.de> - 2013-08-24 11:00 +0200
Re: Passing parameter to external script Swifty <steve.j.swift@gmail.com> - 2013-08-24 10:26 +0100
Re: Passing parameter to external script Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-08-24 12:59 +0100
Re: Passing parameter to external script Swifty <steve.j.swift@gmail.com> - 2013-08-24 17:27 +0100
Re: Passing parameter to external script Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-08-24 19:49 +0100
Re: Passing parameter to external script Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-08-25 23:45 +0100
Re: Passing parameter to external script Swifty <steve.j.swift@gmail.com> - 2013-08-27 20:46 +0100
Re: Passing parameter to external script Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-08-28 19:32 +0100
csiph-web