The function transferData - can this be written in a easier way?

  • 13 years ago

    How would the code below be written in a 'for loop' or some other easier way? Many Thanks

    function transferData() {

    var x,y;

        y=document.getElementById('nameID');
        x=document.getElementById('name');
        x.innerHTML=x.innerHTML+y.value;

        y=document.getElementById('emailID');
        x=document.getElementById('email2');
        x.innerHTML=x.innerHTML+y.value;

        y=document.getElementById('locationID');
        x=document.getElementById('location3');
        x.innerHTML=x.innerHTML+y.value;
    }


Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.”