Saving screen width as a variable

Hi all

I've set up a free format question and am trying to get the screen width saved there. Obviously my javascript skills are woeful so I need a bit of help. Here's what I have (which isn't working):


<input name="ScreenWidth1_var" id="ScreenWidth1_var" type="hidden">

<script type="text/javascript">

function myFunction()
{
var x = screen.width;
document.getElementById("ScreenWidth1_var").innerHTML = x;

document.write(document.getElementById("ScreenWidth1_var").value);
}

</script>


Can someone please put me straight? (I'm using version 8.2.4)

Resolved
2 replies