|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
this code was posted a couple days ago by spookster:
<script language="JavaScript"> <!--// function Browser() { if (navigator.appVersion.indexOf("(X11") != -1 | | navigator.appVersion.indexOf("(Mac") != -1) return 1 else return 0 } function Description(url,dow,winwidth,winheight) { if (stat == 0) { description = window.open(url,'descr',"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,scrollbars=auto,resizable=no ,copyhistory=no,width='+winwidth+',height='+winheight'" ) description.focus() stat=dow if (Browser() == 1 ) {window.open(url,'descr')} } else { description.close() if (stat != dow) { stat=dow description=window.open(url,'descr',"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,scrollbars=auto,resizable=no ,copyhistory=no,width='+winwidth+',height=' +winheight'") description.focus() if (Browser() == 1 ) {window.open(url,'descr')} } else { stat=0 } } } //--> </script> <script language="JavaScript"> <!--// stat=0 dow=0 //--> </script> The link is called by: <a href="javascript:description('http://www.domain.com/products.php','10','300','275')"> It's supposed to check for a browser version with JS enabled, and if not the link should open as a normallink, as opposed to a JS popup window. the script doesn't work though, and i'm a javascript novice.... can anyone help ???? cheers, nick ps thx spookster for the original post ! |
|
#2
|
|||
|
|||
|
I can't help much but I found a couple errors.
The | | should not have a space between them. Should be | |. Also your call to description(). The D is uppercase <a href="javascript escription('http://www.domain.com/products.php','10','300','275')">Also if the browser doesn't support javascript then none of the code will execute. So use this scheme: <script language="javascript"> ... bla bla bla </script> <noscript> HTML .... </noscript> The noscript can't be javascript and will only render if the browser has javascript disabled or doesn't support it. By the way. Beware of copying code from this bulletine board as it modifies spaces between things. Like the | | I can't get it to not have the space there. ------------------ webpatron.com [This message has been edited by lhallusa (edited July 18, 2000).] [This message has been edited by lhallusa (edited July 18, 2000).] [This message has been edited by lhallusa (edited July 18, 2000).] [This message has been edited by lhallusa (edited July 18, 2000).] [This message has been edited by lhallusa (edited July 18, 2000).] |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > open new window depending on if JS enabled or not |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|