displaying the value of a function.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Graham Mattingley

    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(intMon th){
    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("<h tml>");
    this.wwrite("<h ead><title>Cale ndar</title>");
    this.wwrite("<b ody 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

    #2
    Re: displaying the value of a function.

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


    var date = getDateStr()


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



    "Graham Mattingley" <graham@technoc om.com> wrote in message
    news:bi0t27$8vk $1$8300dec7@new s.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(intMon th){
    > 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("<h tml>");
    > this.wwrite("<h ead><title>Cale ndar</title>");
    > this.wwrite("<b ody 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]


    Comment

    Working...