| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Auto Resizing Help | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() 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}
__________________
---------------------------------------------------- X-Cart 3.5.1 \"Heavily Modified\" Win2000 Advanced Server/Apache 2.0.54 w/OpenSSL 0.9.7g PHP 4.4.0/MySQL 4.1.14-nt |
|||||||
#2
|
|||||||
|
|||||||
![]() 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.
__________________
Padraic Ryan Ryan Design Studio Professional E-Commerce Development |
|||||||
#3
|
|||||||
|
|||||||
![]() 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.
__________________
---------------------------------------------------- X-Cart 3.5.1 \"Heavily Modified\" Win2000 Advanced Server/Apache 2.0.54 w/OpenSSL 0.9.7g PHP 4.4.0/MySQL 4.1.14-nt |
|||||||
#4
|
|||||||||
|
|||||||||
![]() Quote:
Can u share the solution ?
__________________
Dongan MercuryMinds Technologies Professional X-Cart Design, X-Cart Development, X-Cart Customization Services www.mercuryminds.com Follow us at Facebook / Twitter |
|||||||||
![]() |
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|