Baby JavaScript question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim Owen

    #1

    Baby JavaScript question

    I never ever need to use Javascript, but in this case I think I do. All I
    want is for a Calendar control to appear when the user clicks a button.
    Being as this isn't worth a trip to the server, I want to add some JS to
    make this happen. What is the script for that? I tried:

    MyButton.Attrib utes.Add("oncli ck","document.f orms[0].MyCalendar.Vis ible='Tru
    e';");

    Though of course I don't know what I'm doing.

    --
    - Jim Owen
    206-501-6936


  • Vidar Petursson

    #2
    Re: Baby JavaScript question

    Hi

    This should toggle the element visibility passed to the function

    function toggleElement(s ElementID){
    if(document.get ElementById)
    {
    var e = document.getEle mentById(sEleme ntId);
    if( e != null ) e.style.visibil ity = ( e.style.visibil ity == "hidden") ?
    "visible" : "hidden";
    }
    }

    MyButton.Attrib utes.Add("oncli ck","toggleElem ent('ELEMENTID' )" );
    Where ELEMENTID is the calendar in your case

    --
    Best Regards
    Vidar Petursson
    =============== ===============
    Microsoft Internet Client & Controls MVP
    =============== ===============
    "Jim Owen" <jkoseattle@com cast.net> wrote in message
    news:On8FvJUUDH A.2088@TK2MSFTN GP10.phx.gbl...[color=blue]
    > I never ever need to use Javascript, but in this case I think I do. All I
    > want is for a Calendar control to appear when the user clicks a button.
    > Being as this isn't worth a trip to the server, I want to add some JS to
    > make this happen. What is the script for that? I tried:
    >
    >[/color]
    MyButton.Attrib utes.Add("oncli ck","document.f orms[0].MyCalendar.Vis ible='Tru[color=blue]
    > e';");
    >
    > Though of course I don't know what I'm doing.
    >
    > --
    > - Jim Owen
    > 206-501-6936
    >
    >[/color]


    Comment

    Working...