HighDots Forums  

Re: =?utf-8?Q?Link_in_neuem_Fenster_?= =?utf-8?Q?=C3=B6ffnen_mittels_CSS?=

Javascript (German) Programmiersprache JavaScript. (de.comp.lang.javascript)


Discuss Re: =?utf-8?Q?Link_in_neuem_Fenster_?= =?utf-8?Q?=C3=B6ffnen_mittels_CSS?= in the Javascript (German) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sebastian Gruber
 
Posts: n/a

Default Re: =?utf-8?Q?Link_in_neuem_Fenster_?= =?utf-8?Q?=C3=B6ffnen_mittels_CSS?= - 02-16-2005 , 12:13 AM






Am Mon, 14 Feb 2005 17:35:44 +0100 schrieb Christoph Päper
<christoph.paeper (AT) nurfuerspam (DOT) de>:

Quote:
Wenn du deine Besucher wirklich (technisch korrekt) ärgern willst, aber
nicht zu doll, kombiniere
http://www.scottandrew.com/weblog/articles/cbs-events> mit z.B.
http://molily.de/javascript-popups>.

Meine DOM- und JS-Kenntnisse sind ziemlich eingerostet, aber vielleicht
kommt dann sowas dabei heraus (und funktioniert):

function externalLinks() {
if (!document.getElementsByTagName) return false;
for (var anchor in document.getElementsByTagName('a'))
with (anchor)
if (getAttribute('href') &&
getAttribute('rel') == 'extern')
addEvent('click', function() {
return !window.open(this.href, this.target);
});
}
ich hab jetzt folgendes:

####

function openwin() {
window.open(this.getAttribute("href"), "neu",
'dependent=no,location=yes,menubar=yes,resizable=y es,scrollbars=yes,status=yes,toolbar=yes');
return false;
}

function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href") && anchor.getAttribute("rel") ==
"extern") {
anchor.onclick = openwin;
}
}
}
window.onload = externalLinks;

####

funktioniert bei mir im IE, im FF und in opera.

--
Sebastian Gruber | http://www.s-gruber.de


Reply With Quote
  #2  
Old   
Sebastian Gruber
 
Posts: n/a

Default Re: =?utf-8?Q?Link_in_neuem_Fenster_?= =?utf-8?Q?=C3=B6ffnen_mittels_CSS?= - 02-16-2005 , 12:25 AM






Am Wed, 16 Feb 2005 06:13:28 +0100 schrieb Sebastian Gruber
<news (AT) s-gruber (DOT) de>:

Quote:
function openwin() {
window.open(this.getAttribute("href"), "neu",
'dependent=no,location=yes,menubar=yes,resizable=y es,scrollbars=yes,status=yes,toolbar=yes');
return false;
}

function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href") && anchor.getAttribute("rel") ==
"extern") {
anchor.onclick = openwin;
}
}
}
window.onload = externalLinks;
wobei ich jetzt noch gern eine möglichkeit finden würde, das ganze den
besucher bei bedarf wieder deaktivieren zu können. bin mehr der
xhtml+css-schreiber. hmmmmm, ich stell mir da was mit von js gesetztem
cookie vor. nur wie?

--
Sebastian Gruber | http://www.s-gruber.de


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.