![]() |
Auto Resizing Help
I am looking for a simple way to automatically size according to customers screen resolution. I have pieced together several snipets of javascript code that looks like it should work to me but generates a runtime error Expected: ')'
For the life of me I can't find what is causing this error and I have tried everything I can think of. Any help would be much appreciated. This is the part that is throwing the error (v 3.51) skin1/customer/home.tpl {literal} <SCRIPT LANGUAGE="JavaScript"> if ((isset($HTTP_GET_VARS["ScrnSize"])) and (!x_session_is_registered("ScrnSize"))) { var ScrnSize = "UnCommon" if (navigator.appVersion.indexOf("4.") != -1 && navigator.appName.indexOf("Explorer") != -1) { ScrnSize = screen.width + "x" + screen.height; } if (navigator.appVersion.indexOf("4.") != -1 && navigator.appName.indexOf("Netscape") != -1) { ScrnSize = screen.width + "x" + (screen.height + 19); } switch(ScrnSize) { case "800x600" : $ScrnSize = "800"; break; case "1024x768" : $ScrnSize = "1024"; break; default : $ScrnSize = "800"; x_session_register("ScrnSize"); $smarty->assign("ScrnSize",$ScrnSize); } } </script> {/literal} |
I'd look for a completed JavaScript on hotscripts.com and try that, as your pieced together version has some code errors in it. I'm not a JavaScript expert, so I can't help, but that would be my suggestion.
|
Javascript Errors
I finally got something to work but in a completely different way. I had never worked with javascript and am very green with php, but I eventually found out that you can't pass a variable directly from javascript to php, since js is client side and php is server side, so the php is actually parsed first and totally seperately from the javascript.
Anyway thanks for taking the time to reply. |
Re: Javascript Errors
Quote:
Can u share the solution ? |
All times are GMT -8. The time now is 08:46 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.