Web Analytics Made Easy -
StatCounter parameter myDIVnode.firstChild.nodeValue not passed to function - CodingForum

Announcement

Collapse
No announcement yet.

parameter myDIVnode.firstChild.nodeValue not passed to function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • parameter myDIVnode.firstChild.nodeValue not passed to function

    why this parameter is not passed to function ?

    Code:
     var myDIVnode1 = document.createElement("DIV");
     // etc
     myDIVnode1.appendChild(document.createTextNode("a"));
     // this shows "a" 
     alert(myDIVnode1.firstChild.nodeValue);
    
     myDIVnode1.onclick= function() { somefunc(myDIVnode.firstChild.nodeValue); };
    
     function somefunc(param)
     {
       // this returns "undefined" !!??
       alert(param);
     }
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #2
    perhaps a typo?

    Code:
    // Change
    myDIVnode1.onclick= function() { somefunc(myDivNode.firstChild.nodeValue);
    
    // To
    myDIVnode1.onclick= function() { somefunc(myDivNode1.firstChild.nodeValue);
    Notice the 1 after myDivNode not present in your code.
    Active PHP/MySQL application developer available for immediate work.
    syosoft.com mavieo.com - Remote Web Site Administration Suite - Reseller Ready

    Comment


    • #3
      yes typo. Will prowide sample and link ...
      Found a flower or bug and don't know what it is ?
      agrozoo.net galery
      if you don't spot search button at once, there is search form:
      agrozoo.net galery search

      Comment


      • #4
        So that wasnt the problem?
        Active PHP/MySQL application developer available for immediate work.
        syosoft.com mavieo.com - Remote Web Site Administration Suite - Reseller Ready

        Comment


        • #5
          ahh sorry, the bug was somewhere else

          in real case I had:

          Code:
          function somefunc(param1,param2)
          {
            // tons of stuff (-:  ....
            alert(param3);
          }
          didn't see that there is no param3, although I did send 3 params to func. Hmm.

          Thanks for help.
          Last edited by BubikolRamios; Oct 1, 2006, 06:01 AM.
          Found a flower or bug and don't know what it is ?
          agrozoo.net galery
          if you don't spot search button at once, there is search form:
          agrozoo.net galery search

          Comment

          Working...
          X