|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Positioning a form crashes IE 5.5
I have written a script which centers web page elements by changing the position of a style element according to the width of the page.
The script works fine until I put a form inside the style element on the page. Then it crashes IE5.5 and AOL 7 (kills dead!). Is there something wrong with doing this. My HTML code and Script follows: **Script** function CentreWebDesign(DesignWidth) { var LeftStart=0; var PageSize=0; if (document.body.clientWidth != null) { PageSize=document.body.clientWidth; } else { if (window.innerWidth != null) { PageSize=document.innerWidth; } } if (PageSize > DesignWidth) { LeftStart=Math.round((PageSize - DesignWidth)/2); } document.getElementById('container').style.left = LeftStart; } **End Script** **HTML** <html> <head> <title>title</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript" type="text/JavaScript" src="c.js"></script> <link href="content.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- #container{position: absolute; top: 15px; left: 0px} --> </style> </head> <body onLoad="CentreWebDesign(740); MM_preloadImages('images/faq-o.gif','images/contacts-o.gif','images/clients-o.gif','images/features-o.gif','images/services-o.gif','images/about-o.gif','images/home-o.gif')" onResize="CentreWebDesign(740)"> <div id="container"> <div class="heading">how to contact us</div> <div class="content"> <form name="form1" method="post" action="thanks.php"> <table width="670" border="0" align="center" cellpadding="0" cellspacing="5" summary="Enquiry Form"> <tr> <td width="158"><p class="formtext">Your Requirements</p></td> <td width="487"><label for="textarea"></label> <textarea name="requirements" id="requirements"></textarea></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="Submit" value="Submit" id="Submit" style="background-color: #DEEFAD; color: #336633; border: 1 solid #3FBE7B;"> <input type="hidden" name="stage" value="process"> <input type="reset" name="Reset" value=" Reset" id="label" style="background-color: #DEEFAD; color: #336633; border: 1 solid #3FBE7B;"></td> </tr> </table> </form> <p><br> </p> <img src="images/bottom.gif" width="720" height="78" alt=""></div> </div> </body> </html> **End HTML** Any help would be great, this has bugged me for days! |
|
#2
|
|||
|
|||
|
RE: Positioning a form crashes IE 5.5
No crashes here (win95 IE5.5), although I do get an error on the MM_preloadImages, but I assume you have this function in your original version.
I would do the centering function a little different though; this is what I would make of it: function CentreWebDesign(DesignWidth) { var PageSize = document.body.clientWidth || window.innerWidth; if (PageSize > DesignWidth) { var LeftStart = Math.round((PageSize - DesignWidth)/2); document.getElementById('container').style.left = LeftStart+'px'; } } |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > Positioning a form crashes IE 5.5 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|