Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. parameter passing i javascript [modified]

parameter passing i javascript [modified]

Scheduled Pinned Locked Moved ASP.NET
javascriptquestion
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sonia Gupta
    wrote on last edited by
    #1

    if (!Page.IsPostBack) { int h = 0; int k = 0; int j = 0; for (int m = 0; m < 2; m++) { k = h++; // k = ++h; } Button1.Attributes.Add("OnClick", "javascript:return abc(" + h + ");"); } function abc(var d) { alert(d); return false; } i am comminting any mistake somewhere? Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1 -- modified at 4:23 Tuesday 30th October, 2007

    I S C I 4 Replies Last reply
    0
    • S Sonia Gupta

      if (!Page.IsPostBack) { int h = 0; int k = 0; int j = 0; for (int m = 0; m < 2; m++) { k = h++; // k = ++h; } Button1.Attributes.Add("OnClick", "javascript:return abc(" + h + ");"); } function abc(var d) { alert(d); return false; } i am comminting any mistake somewhere? Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1 -- modified at 4:23 Tuesday 30th October, 2007

      I Offline
      I Offline
      InsDev
      wrote on last edited by
      #2

      the mistake in javascript define function like abc(d) Devjit das

      1 Reply Last reply
      0
      • S Sonia Gupta

        if (!Page.IsPostBack) { int h = 0; int k = 0; int j = 0; for (int m = 0; m < 2; m++) { k = h++; // k = ++h; } Button1.Attributes.Add("OnClick", "javascript:return abc(" + h + ");"); } function abc(var d) { alert(d); return false; } i am comminting any mistake somewhere? Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1 -- modified at 4:23 Tuesday 30th October, 2007

        S Offline
        S Offline
        Shujaat Ullah Khan
        wrote on last edited by
        #3

        I hope you have written this javascript function in your html code function abc(var d) { alert(d); return false; } if not plz do so and remove var from the definition of your function it will make function look like this function abc(d) { alert(d); return false; } now your function will work.

        Shujaat

        1 Reply Last reply
        0
        • S Sonia Gupta

          if (!Page.IsPostBack) { int h = 0; int k = 0; int j = 0; for (int m = 0; m < 2; m++) { k = h++; // k = ++h; } Button1.Attributes.Add("OnClick", "javascript:return abc(" + h + ");"); } function abc(var d) { alert(d); return false; } i am comminting any mistake somewhere? Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1 -- modified at 4:23 Tuesday 30th October, 2007

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Have you bought a book yet ?

          Sonia Gupta wrote:

          int h = 0; int k = 0; int j = 0; for (int m = 0; m < 2; m++) { k = h++; // k = ++h; }

          This stuff is a waste of time. Just set h = 2 and be done with it.

          Sonia Gupta wrote:

          Button1.Attributes.Add("OnClick", "javascript:return abc(" + h + ");");

          I think you mean onclick, it's all lower case. You could set OnClientClick in your aspx, or set that property without using the Attributes collection.

          Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          1 Reply Last reply
          0
          • S Sonia Gupta

            if (!Page.IsPostBack) { int h = 0; int k = 0; int j = 0; for (int m = 0; m < 2; m++) { k = h++; // k = ++h; } Button1.Attributes.Add("OnClick", "javascript:return abc(" + h + ");"); } function abc(var d) { alert(d); return false; } i am comminting any mistake somewhere? Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1 -- modified at 4:23 Tuesday 30th October, 2007

            I Offline
            I Offline
            Imran Khan Pathan
            wrote on last edited by
            #5

            Sonia Gupta wrote:

            f (!Page.IsPostBack) { int h = 0; int k = 0; int j = 0; for (int m = 0; m < 2; m++) { k = h++; // k = ++h; } Button1.Attributes.Add("OnClick", "javascript:return abc(" + h + ");"); }

            Add attributes out of condition for page postback.

            int h=2;
            Button1.Attributes.Add("OnClick", "javascript:return abc(" + h + ");");
            if(!ispostback)
            {
            //
            }

            bEst Regard pAthan

            please don't forget to vote on the post that helped you.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups