You can try the following:
var xx = document.getElementById("<%= HiddenField1.ClientID%>");
var yy = document.getElementById("<%= HiddenField2.ClientID%>");
You can look here to see a very detailed explanation of why this is necessary. According to this link, in a few words:
When the web server control is displayed as an HTML element, the identifier attribute of the HTML element is set to ClientID property. The ClientID value is often used to access the HTML element in the client script using the document.getElementById method.
A more understandable approach to the whole problem would be as follows:
script , </body>
<script>
function PantallaResolucion(){
var width = screen.width.toString();
var height = screen.height.toString();
var hiddenFld1 = document.getElementById("<%= HiddenField1.ClientID%>");
var hiddenFld2 = document.getElementById("<%= HiddenField2.ClientID%>");
hiddenFld1.value = width;
hiddenFld2.value = height;
var textBox1 = document.getElemenetById("<%=TextBox1.ClientID%>");
textBox1.value = hiddenFld1.value + "x" + hiddenFld2.value;
}
</script>
Page_Load. , . script.