Javascript functioncall

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MarkoKlacar
    Recognized Expert Contributor
    • Aug 2007
    • 296

    Javascript functioncall

    Hi,

    Can anyone shed some light on statements that look like this:

    Code:
    <html:submit onClick="varble = true; othervariable = false"/>
    The code is from a .jsp page, other things you should know is that it uses Java, Struts and WLS.

    Any help appreciated.

    Marko
  • iam_clint
    Recognized Expert Top Contributor
    • Jul 2006
    • 1207

    #2
    What do you need to know about it?

    Code:
    <html:submit onClick="varble = true; othervariable = false"/>
    so <html:submit>

    makes a submit button I can only assume

    and onClick.. that means when the button is clicked it sets two global variables because the word var isn't infront of the variables.

    Comment

    • MarkoKlacar
      Recognized Expert Contributor
      • Aug 2007
      • 296

      #3
      Hi,

      I figured that much, problem is I can't seem to find the variables declared anywhere...

      Is that type of call common?

      /MK

      Comment

      • Rsmastermind
        New Member
        • Sep 2008
        • 93

        #4
        The code tells about the Html struts tags.To include it in the jsp we need to write
        Code:
        <%@ taglib uri="/tags/struts-html" prefix="html" %>
        now as per the attributes here
        These codes usually works in the server side as you have to define actions related means when you submit the form

        Comment

        • gits
          Recognized Expert Moderator Expert
          • May 2007
          • 5388

          #5
          those variables are set onclick of the submit button and should be accessible globally from javascript until the page is submitted ... because this will reload the page unless there is any other code that avoids the submit.

          while the onclick is common i would say the use of globals is common for beginners and should be avoided whenever possible ...

          kind regards

          Comment

          • MarkoKlacar
            Recognized Expert Contributor
            • Aug 2007
            • 296

            #6
            Hey guys,

            Thanks for you helpful responses, I think I get it now.

            Thanks,
            Marko

            Comment

            Working...