title: Return value from onload method and assign to variable
body: <p>Is it possible to return value from a onload method and assign to a variable in javascript? I have multiple values to be returned from method.  I don't want to print that in html (I know how to print) but I want it to assign to a variable.</p>
  
  <pre><code>&lt;html&gt;
  
  &lt;div id="screenCapture" onload="screenProperties()"&gt;Screen properties&lt;/div&gt;
  
  &lt;p id="sW"&gt; &lt;p&gt;
  
  &lt;/body&gt;
  
  &lt;script type="text/javascript"&gt;
  function screenProperties(){
  
      sW=screen.width;
      sH=screen.height;
      saW=screen.availWidth;
      saC=screen.colorDepth;
      pixelDepth=screen.pixelDepth;
  
  return  "sw:"+sW+"sH:"+sH+"saW:"+saW+"saC:"+saC+"pixelDepth:"+pixelDepth;
  
  }
  alert(screenProperties());
  &lt;/script&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>is my method. Here, I want to assign the returned value to a variable in html side. </p>