I am needing help with what is probably a very easy task to complete, but I have been working on it for a while and need another pair of eyes to help me figure out the missing piece. I should know how to do this but for some reason the correct layout of the code is beyond my scope of vision. Below is one way i tried writing the code, including the html elements of the page. I have also tried using a function to perform the task.
<html> <head> <title>Swapping the boxes!</title> </head> <body> <center> <h2> <font color= "purple" face= "comic sans MS"> Swap the text entered from one to the other! </font> </h2> <br/> <br/> Enter text in each box: <br/> <input type="text" id="txt1" size= "15" value= "" />     <input type="text" id="txt2" size= "15" value= "" /> <br/> <input type= "button" value= "Swap Text" onclick = "text1= document.getElementById('txt1').value; text1=parseFloat(text1); text2= document.getElementById('txt2').value; text2=parseFloat(text2); document.getElementById('txt1').value= text2; document.getElementById('txt2').value= text1;" /> </center> </body> </html>
Edited by mike_2000_17: Fixed formatting