Script Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rsrinivasan
    New Member
    • Mar 2007
    • 221

    #16
    Originally posted by dmjpro
    hello ... i told u to write ..... anonymous function .....

    u should write function() only instead of .... funciton ff() ... understood..
    best of luck.

    kind regards.
    dmjpro.
    Hi,
    I try it in both way. But it did not fire, when i click.

    Thanks,
    Srinivas r.

    Comment

    • dmjpro
      Top Contributor
      • Jan 2007
      • 2476

      #17
      now try a sample code.

      <body onload = test1()>
      <input type = button id = test_name>
      </body>

      now write in script part....

      function test1()
      {
      document.getEle mentById('test_ name').onClick = function(){aler t('DMJPRO: yahoooooo...... ..');}
      }

      plz give me the feed back immediately .. i m online.
      i ll not sign out untill u give me the feed back.

      kind regards.
      dmjpro.

      Comment

      • rsrinivasan
        New Member
        • Mar 2007
        • 221

        #18
        Originally posted by dmjpro
        now try a sample code.

        <body onload = test1()>
        <input type = button id = test_name>
        </body>

        now write in script part....

        function test1()
        {
        document.getEle mentById('test_ name').onClick = function(){aler t('DMJPRO: yahoooooo...... ..');}
        }

        plz give me the feed back immediately .. i m online.
        i ll not sign out untill u give me the feed back.

        kind regards.
        dmjpro.
        Hi,
        Sorry. Yesterday I went out. Thats why I cant reply immediately. I try your code today. But it did not work. Im creating TD id also in javascript(dyna mically) as below. So when i refer
        document.getEle mentById('myEle m.id')
        it gives error

        Code:
        myElem.id   = dealMenu[i]
        Thanks,
        Srinivas r

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #19
          Originally posted by rsrinivasan
          Im creating TD id also in javascript(dyna mically) as below. So when i refer document.getEle mentById('myEle m.id') it gives error
          Code:
          myElem.id   = dealMenu[i]
          Get rid of the quotes and use
          Code:
          document.getElementById(myElem.id)
          because that contains the actual id.

          Did you change the onClick to onclick?

          Comment

          • sumittyagi
            Recognized Expert New Member
            • Mar 2007
            • 202

            #20
            Originally posted by rsrinivasan
            Hi,
            I try it. I replaced my code with ur code. But it did not work. what to do?

            Code:
            	myElem.onClick = function ff(){alert('Helooo.....Yahoooooo');}
            Thanks,
            Srinivas r.
            The best way is to use DOM standard functions so that ur code become browser independent.
            Code:
            if(item.attachEvent)
            {
            	item.attachEvent('onmousedown', functionName);
            }
            else
            {
            	item.addEventListener('mousedown', functionName, false);
            }
            Note:- difference between function call and function reference is that, function call is function name with paranthesis, while function reference is function name without parenthesis.

            Whenever you define any anonymous function then it returns its reference, so you can also get reference of anyonymous function.

            ~~Cheers~~ ;-)

            Comment

            • rsrinivasan
              New Member
              • Mar 2007
              • 221

              #21
              Originally posted by sumittyagi
              The best way is to use DOM standard functions so that ur code become browser independent.
              Code:
              if(item.attachEvent)
              {
              	item.attachEvent('onmousedown', functionName);
              }
              else
              {
              	item.addEventListener('mousedown', functionName, false);
              }
              Note:- difference between function call and function reference is that, function call is function name with paranthesis, while function reference is function name without parenthesis.

              Whenever you define any anonymous function then it returns its reference, so you can also get reference of anyonymous function.

              ~~Cheers~~ ;-)
              Hi,
              I solved my problem in some other way. But your code looking nice. I'll try your code also.

              Thanks for ur reply,
              Srinivas r.

              Comment

              • rsrinivasan
                New Member
                • Mar 2007
                • 221

                #22
                Originally posted by sumittyagi
                The best way is to use DOM standard functions so that ur code become browser independent.
                Code:
                if(item.attachEvent)
                {
                	item.attachEvent('onmousedown', functionName);
                }
                else
                {
                	item.addEventListener('mousedown', functionName, false);
                }
                Note:- difference between function call and function reference is that, function call is function name with paranthesis, while function reference is function name without parenthesis.

                Whenever you define any anonymous function then it returns its reference, so you can also get reference of anyonymous function.

                ~~Cheers~~ ;-)
                Hi,
                I solved it. But i have another problem.

                Im using two frame in my jsp page. In this first frame has header and second frame has body. In the header frame i have one menu. When I scroll down the body frame, the menu item is hidden by the body frame. How to resolve it...

                Thanks,
                Srinivas r.

                Comment

                Working...