#!/COMMUNITY
Members: 5374
davon online: 1
weitere User: 27
12.02.2012 / 09:57
Community-Member werden
|
Paßwort vergessen
|
OnlineMonitor (1)
Perl-Archiv
Forum
Javascript
Home
PERLscripts
PHPscripts
JAVAscripts
Hilfreiches
Links2www
Newscenter
Community
Interna
Javascript
Archivübersicht
Tutorials
Zum Forum
JS-Links
BuchTipps
WebForen
Forenübersicht
Neueste Themen
Ohne Antwort
Aktivste Themen
Themensuche
Forenarchiv
Newsgroups
Javascript » Nützliches » Center Window Wizard
zur Übersicht
Kategorie
Nützliches
Bezeichnung
Center Window Wizard
ScriptDemo
Neues Fenster für Demo öffnen
Statistik
16088 Aufrufe davon 2x gestern
Dieser Wizard hilft Ihnen, um ein zentriertes Fenster auf dem Bildschirm anzuzeigen.
Javascript-Quellcode
(einfach markieren, kopieren und lokal abspeichern)
<script language=javascript type=text/javascript> <!-- var win=null; function NewWindow(mypage,myname,w,h,scroll,pos){ if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;} if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;} else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20} settings='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=no,toolbar=yes'; win=window.open(mypage,myname,settings); if(win.focus){win.focus();}} function CloseNewWin(){if(win!=null && win.open)win.close()} window.onfocus=CloseNewWin; function GenerateNewWindowCode(form){ pg=document.ScriptOptions.page.value;page='"'+pg+'"';nm=document.ScriptOptions.WinName.value;sb=document.ScriptOptions.scrollbars.options[document.ScriptOptions.scrollbars.selectedIndex].value;loc=document.ScriptOptions.loc.checked;dir=document.ScriptOptions.dir.checked;stat=document.ScriptOptions.stat.checked;mb=document.ScriptOptions.mb.checked;tb=document.ScriptOptions.tb.checked;res=document.ScriptOptions.res.checked;WhichPosition=document.ScriptOptions.WhichPos.options[document.ScriptOptions.WhichPos.selectedIndex].value;NumOfWin=document.ScriptOptions.NumOfWin.options[document.ScriptOptions.NumOfWin.selectedIndex].value;w=document.ScriptOptions.wdth.value;h=document.ScriptOptions.hght.value; if(pg==""){alert('You need to specify a page to be displayed in the window');document.ScriptOptions.page.focus();return false;} if(nm==""){alert('You need to specify a name for the window');document.ScriptOptions.WinName.focus();return false;} if(w==""){alert('You need to specify a width for the window');document.ScriptOptions.wdth.focus();return false;} if(h==""){alert('You need to specify a height for the window');document.ScriptOptions.hght.focus();return false;} NewWindowSettings = "settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',"+((loc)?"location=yes,":"location=no,")+((dir)?"directories=yes,":"directories=no,")+((stat)?"status=yes,":"status=no,")+((mb)?"menubar=yes,":"menubar=no,")+((tb)?"toolbar=yes,":"toolbar=no,")+((res)?"resizable=yes":"resizable=no")+"'"; StartCode='<scr'+'ipt language="javascript" type="text/javascript">\r\n<!--\r\n' + '/****************************************************\r\n' + ' Author: Eric King\r\n Url: http://redrival.com/eak/index.shtml\r\n This script is free to use as long\r\n as this info is left in\r\n' + '****************************************************/\r\n' MainCode='var win=null;\r\n' + 'function NewWindow(mypage,myname,w,h,scroll,pos){\r\n' + 'if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}\r\n' + 'if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}\r\n' + 'else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}\r\n' + NewWindowSettings+';\r\n' + 'win=window.open(mypage,myname,settings);\r\n' + 'if(win.focus){win.focus();}}\r\n' CloseCode='function CloseNewWin(){if(win!=null && win.open)win.close()}\r\n'+'window.onfocus=CloseNewWin;\r\n' EndCode='// -->\r\n</scr'+'ipt>' if(NumOfWin=="one"){HeadCode=StartCode+MainCode+CloseCode+EndCode} if(NumOfWin=="many"){HeadCode=StartCode+MainCode+EndCode} BodyCode="<a href="+page+" onclick=\"NewWindow(this.href,'"+nm+"','"+w+"','"+h+"','"+sb+"','"+WhichPosition+"');return false\" onfocus=\"this.blur()\">YourLinkText</a>"; document.ScriptOptions.NewWindowV3_headsection.value=HeadCode; document.ScriptOptions.bodylink.value=BodyCode; document.ScriptOptions.NewWindowV3_headsection.focus()} // --> </script> <form name=ScriptOptions> <table border=0 cellpadding=2 cellspacing=2> <tbody> <tr> <td> <p>URL of window</p> </td> <td> <input maxlength=50 name=page> </td> </tr> <tr> <td> <p>Name of window</p> </td> <td> <input maxlength=50 name=WinName> </td> </tr> <tr> <td> <p>Width</p> </td> <td> <input maxlength=3 name=wdth size=3 type=number> </td> </tr> <tr> <td> <p>Height</p> </td> <td> <input maxlength=3 name=hght size=3 type=number> </td> </tr> <tr> <td> <p>Scroll Bar</p> </td> <td> <select name=scrollbars> <option selected value=no>no</option> <option value=yes>yes</option> </select> </td> </tr> <tr> <td> <p>Location Bar</p> </td> <td> <input name=loc type=checkbox class="inputcheck"> </td> </tr> <tr> <td> <p>Directories</p> </td> <td> <input name=dir type=checkbox class="inputcheck"> </td> </tr> <tr> <td> <p>Status Bar</p> </td> <td> <input name=stat type=checkbox class="inputcheck"> </td> </tr> <tr> <td> <p>Menu Bar</p> </td> <td> <input name=mb type=checkbox class="inputcheck"> </td> </tr> <tr> <td> <p>Tool Bar</p> </td> <td> <input name=tb type=checkbox class="inputcheck"> </td> </tr> <tr> <td> <p>Resizable</p> </td> <td> <input name=res type=checkbox class="inputcheck"> </td> </tr> <tr> <td> <p>Position On Screen</p> </td> <td> <select name=WhichPos> <option selected value=center>Center</option> <option value=random>Random</option> </select> </td> </tr> <tr> <td> <p>How many windows do you<br> want open at one time?</p> </td> <td> <select name=NumOfWin> <option selected value=many>As many as possible</option> <option value=one>Just 1 window</option> </select> </td> </tr> <tr> <td> <input onclick=GenerateNewWindowCode() type=button value="Generate Code" name="button" class="go"> </td> <td> <input type=reset value=Reset name="reset" class="go"> </td> </tr> </tbody> </table> <input onclick=this.form.NewWindowV3_headsection.focus();this.form.NewWindowV3_headsection.select(); type=button value="Select Text" name="button" class="go"> <br> Insert the following code into the head section of your html document.<br> <textarea cols=50 name=NewWindowV3_headsection rows=15 wrap=off></textarea> <br> <br> <input onclick=this.form.bodylink.focus();this.form.bodylink.select(); type=button value="Select Text" name="button" class="go"> <br> Insert the following code into your document where you want the link. <br> <textarea cols=50 name=bodylink rows=5 wrap=off></textarea> </p> </form>
Kommentare zu
Center Window Wizard
0 Kommentar(e) vorhanden / Anzeige der neuesten 5
Noch keine Kommentare zu diesem Javascript vorhanden.
Alle Kommentare anzeigen
-
Kommentar hinzufügen
© PERL/CGI/
PHP
/JS/SCRIPT/unity.de 1998-2009 .::.
interaktiv.shop
.::.
CGI-Service
.::.
Kontakt
.::.
Impressum
Link: /javascript/scripts/javascript_0246_main.shtml .::. Aufrufe heute: 2 .::. Aufrufe gesamt: 11432