calling javascript function in link button click

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lintas
    New Member
    • May 2007
    • 1

    #1

    calling javascript function in link button click

    Hi All,

    I am using a java script function for opening a pop up window in a link button click. And I am able to call the function at link button's second click only. I am not able to call the java scritp at its first clic. Except this java script call, any thing i can do at first click itself. I have tried many alternatives..b ut no use...can any one hep me?

    I have tried in two ways :

    1) lnkShipper.Attr ibutes.Add("onC lick", "javascript:Shi pperAddress();" );(in client side)
    2)lnkShipper.At tributes.Add("o nClick", "window.open('S hipperDetails.a spx',null,'heig ht=300,width=60 0,status=yes,to olbar=no,menuba r=no,location=n o');"); (in code behind)



    please advice
  • Paulson
    New Member
    • Apr 2007
    • 63

    #2
    Originally posted by lintas
    Hi All,

    I am using a java script function for opening a pop up window in a link button click. And I am able to call the function at link button's second click only. I am not able to call the java scritp at its first clic. Except this java script call, any thing i can do at first click itself. I have tried many alternatives..b ut no use...can any one hep me?

    I have tried in two ways :

    1) lnkShipper.Attr ibutes.Add("onC lick", "javascript:Shi pperAddress();" );(in client side)
    2)lnkShipper.At tributes.Add("o nClick", "window.open('S hipperDetails.a spx',null,'heig ht=300,width=60 0,status=yes,to olbar=no,menuba r=no,location=n o');"); (in code behind)



    please advice
    Hi Lintas,

    I read your problem.I am not a programming

    expert but still what I think the problem is that

    1. You are adding the function attribute to linkclick only on

    link click

    -->[That is when you first click the link only the attribute
    is added]

    2. Then on the next click it is already there so it works

    properly (Hope you got the meaning of what I meant).


    So what I would suggest is that you try adding it on

    -->onload<-- instead of -->onclick()<--

    I dont know if this will solve your problem but please check out.

    Bye keep the good work going bye Paulson

    Comment

    • neoupadhyay
      New Member
      • Feb 2007
      • 57

      #3
      Originally posted by lintas
      Hi All,

      I am using a java script function for opening a pop up window in a link button click. And I am able to call the function at link button's second click only. I am not able to call the java scritp at its first clic. Except this java script call, any thing i can do at first click itself. I have tried many alternatives..b ut no use...can any one hep me?

      I have tried in two ways :

      1) lnkShipper.Attr ibutes.Add("onC lick", "javascript:Shi pperAddress();" );(in client side)
      2)lnkShipper.At tributes.Add("o nClick", "window.open('S hipperDetails.a spx',null,'heig ht=300,width=60 0,status=yes,to olbar=no,menuba r=no,location=n o');"); (in code behind)



      please advice
      well y u dnt try this code at the palce of ur JS code caing
      lnkShipper.Attr ibutes.Add("onC lick", "javascript:win dow.open('Addre ss of ur Aspx page,' ','status=yes,m enubar=no,,scro llbars=1,height =850,width=600' ) ");

      Comment

      Working...