Connecting Tech Pros Worldwide Help | Site Map

displaying the value of a function.

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 09:46 AM
Graham Mattingley
Guest
 
Posts: n/a
Default displaying the value of a function.

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




  #2  
Old July 20th, 2005, 09:46 AM
steve stevo
Guest
 
Posts: n/a
Default 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]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.