Skip to main content
Known Participant
May 19, 2010
Question

javascript issue

  • May 19, 2010
  • 1 reply
  • 346 views

Hey guys, not sure whether posted this in correct forum, so please move it if that's a case. (overall working with coldfusion so hopefuly right place)

I'm having a bit of a trouble with one bit of javascript:

   var cell3 = row.insertCell(2);
   cell3.style.verticalAlign = "top";
   var element2 = document.createElement("input");
   element2.type = "text";
   element2.id = "add1_" + (appname + 1);
   element2.name = "add1_" + (appname + 1);
   var myName = element2.name;
   element2.setAttribute('onBlur', 'initialCap(element2.name)');
   cell3.className = "schoolborder";
   cell3.appendChild(element2);

bold line is where i'm stuck. I need to pass element2.name value but unless I write : initialCap(add1_1) it doesn't work. Is there any way to insert variable in this place?

cheers,

Simon

    This topic has been closed for replies.

    1 reply

    Simon.DauAuthor
    Known Participant
    May 19, 2010

    nevermind, sorted it out myself.

    If anyone will get stuck at this use the following to solve it:

    element2.setAttribute('onBlur', 'initialCap(this)');

    cheers,

    Simon