The firstNum and secNum variables are available to the function, but you have made several errors in the code.
First off, the text box references, you can't simply treat their names as a variable like you have done, something more like this is required:
var firstNum = document.myForm.num1.value;
Or this:
var secNum = document.forms['myForm'].elements['num2'].value;
Or one of the several other ways it's possible to access form elements.
However, since the page has already loaded by the time the button is hit, even with the correct references to the text boxes, the firstNum and secondNum variables contain the values the text boxes had when the page loaded, which is an empty string, so you should move those references inside the function to get the current values.
Thirdly, you are treating strings as numbers. JavaScript is pretty forgiving with this sort of stuff, but as a matter of good practice, you really should convert them to one of the number data types first. If you only wish to check integers you can use the parseInt function, but if you wish to check decimals too, you can use the parseFloat function.
Finally, because the page has finished loading, you cannot use document.write() since that will replace the entire source code of the page. You can only use that before the page has finished loading. For an easy way to display the result you could just use an alert(), or have a third text box to put the answer into, or you could use innerHTML or similar to actually write the result to the page as I'm sure you intended document.write() to do.
Incidentally, the actual challenge never required any of this, it only states that a function take two arguments (yours has none) and returns the larger (your function returns nothing).
function max(a,b){
if( a>b ){
return a;
}else{
return b;
}
}
The above would be called like so:
alert("Which is larger, 27 or 13?\nAh, "+max(27,13)+" of course!");