How to call Javascript function in single statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • siddu
    New Member
    • Nov 2006
    • 42

    How to call Javascript function in single statement

    How to call Javascript function in single statement, I have to call these two statements in a single onClick

    img.Attributes( "onclick") = "toggleSidebar( " + IDPREFIXSIDEBAR CONTENT + CStr(tab.Id) + ")"

    img.Attributes( "onclick") = "showTab(" + IDPREFIXTAB + CStr(res.Id) + ", '" + param + "');"

    Please advice me how to call above two statements in single img.Attributes( "onclick")?

    Thanks,
    Vidyasagar
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    [code=javascript]img.onclick = function () {
    toggleSidebar(' IDPREFIXSIDEBAR CONTENT' + CStr(tab.Id));
    showTab('IDPREF IXTAB' + CStr(res.Id), param);
    };[/code]

    Remove the single quotes if the strings in capitals are variable names.

    Comment

    Working...