As F-ES Sitecore wrote, the JavaScript code is run (in the client side when the browser shows the HTML document) only after the .NET code has been run (in the server side) and, an HTML document has been created from it. The JavaScript code isn't run when rendering the page in the server side (it just a text that is copied to the created HTML document). So it can't work by just writing a simple assignment (like you tried).
But, if you want a mechanism for changing a server's .NET objects values according to client's JavaScript objects values, you can try my WebBinding.