jquery - how can i pass a value of script into html page.. eg i have calculated the size of screen and now i want to use the value in html form -
how can pass value of script html page.. eg have calculated size of screen , want use value in html form
<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>mess</title> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> function alertsize(){ var width = $(window).width(); var height = $(window).height(); alert(width) alert(height) } </script> </head> <body onload="alertsize()"> <form style="position: absolute;height : ??;width: ??"> <div style="position: absolute;height: 50%;width:40%;top: 30%;left: 50%;background: #222930"> <div style="position: absolute;height: 70%;width:50%;top: 10%;left: 10%;background: #4eb1ba"> <h4 style="color: #e9e9e9">enter user name <input type="text" id="user"></h4> <h4>enter password <input type="text" id="pass"></h4> <input type="submit" id="sub" value="submit" > <input type="reset" value="reset"> <input type="button" value="forget pass" id="fpass"> </div> </div> </form> </body>
i'm not quite understanding usefulness of this, achieve you're asking, you'll need select html elements using jquery, , apply width , heights css. example:
$('form').css({ width: width +'px', height: height + 'px' });
Comments
Post a Comment