Connecting Tech Pros Worldwide Help | Site Map

displaying the value of a function.

Graham Mattingley
Guest
 
Posts: n/a
#1: Jul 20 '05
Hi Group,

I am new to Javascript and would like to know who do the following, I
suspect it is quite easy..

I have a function
++++++++++++++++++++++++++++++++++++++++++++++++
function GetMonth(intMonth){
var MonthArray = new Array("Jan", "Feb", "Mar",
"Apr", "May", "Jun",
"Jul", "Aug", "Sep",
"Oct", "Nov", "Dec")
return MonthArray[intMonth]
}
function getDateStr(){
var today = new Date()
var year = today.getYear()
if(year<1000) year+=1900
var todayStr = GetMonth(today.getMonth()) + " " + today.getDate()
todayStr += ", " + year
return todayStr
}
++++++++++++++++++++++++++++++++++++++++++++++++++

and I want to display the value of the function using the
this.wwrite command

I want to add it to this code (this bulids a pop window), I want the date to
appear in the popup.

this.wwrite("<html>");
this.wwrite("<head><title>Calendar</title>");
this.wwrite("<body topmargin='0' leftmargin='0'>");
this.wwrite("</head>");


I tryed something like

var date = getDateStr()
this.wwrite date;

but this caused an error

Kind Regards

Graham Mattingley



steve stevo
Guest
 
Posts: n/a
#2: Jul 20 '05

re: displaying the value of a function.


ok you just need to add the string to the html code


var date = getDateStr()


this.wwrite("<body topmargin='0' leftmargin='0'>" + date + "</body>");



"Graham Mattingley" <graham@technocom.com> wrote in message
news:bi0t27$8vk$1$8300dec7@news.demon.co.uk...[color=blue]
> Hi Group,
>
> I am new to Javascript and would like to know who do the following, I
> suspect it is quite easy..
>
> I have a function
> ++++++++++++++++++++++++++++++++++++++++++++++++
> function GetMonth(intMonth){
> var MonthArray = new Array("Jan", "Feb", "Mar",
> "Apr", "May", "Jun",
> "Jul", "Aug", "Sep",
> "Oct", "Nov", "Dec")
> return MonthArray[intMonth]
> }
> function getDateStr(){
> var today = new Date()
> var year = today.getYear()
> if(year<1000) year+=1900
> var todayStr = GetMonth(today.getMonth()) + " " + today.getDate()
> todayStr += ", " + year
> return todayStr
> }
> ++++++++++++++++++++++++++++++++++++++++++++++++++
>
> and I want to display the value of the function using the
> this.wwrite command
>
> I want to add it to this code (this bulids a pop window), I want the date[/color]
to[color=blue]
> appear in the popup.
>
> this.wwrite("<html>");
> this.wwrite("<head><title>Calendar</title>");
> this.wwrite("<body topmargin='0' leftmargin='0'>");
> this.wwrite("</head>");
>
>
> I tryed something like
>
> var date = getDateStr()
> this.wwrite date;
>
> but this caused an error
>
> Kind Regards
>
> Graham Mattingley
>
>
>[/color]


Closed Thread