Start New Discussion within our Web Development Community
function smile ()
        {
            document.getElementById("textfield_width").value = width; 
            //set the elements with id "textfield_width" some value the value of the variable width-->
            document.getElementById("textfield_height").value = height; 
            // set the elements with id "textfield_height" some value the value of the variable height  -->

        }

Well the snippet above shows you comments that indicate the purpose of the code. You are missing the width and height variable declarations and assignments.

the comments are included,
this is not a function, this is an explanation of how part of a function could be coded.
It is incorrect, the explanation refers to "elements with the id", when ID is singular and multiple elements cannot have the same ID,
throw it away and get a different tutorial, from somebody who has a basic idea of what they are doing

set the elements with id "textfield_height" some value the value of the variable height

This article has been dead for over six months. Start a new discussion instead.