Autor Beitrag
Handycommander
ontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1054

Windows XP Pro, Vista
Visual Studio 2008
BeitragVerfasst: Mi 26.01.05 16:04 
Hallo,

kann mir jemand mal sagen, wie ich dieses Script, per Image-Klick einfügen kann? Ist von einer HTML-Seite aus.

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
<SCRIPT LANGUAGE = "JavaScript">
var name = navigator.appName;
var vers = navigator.appVersion;
vers = vers.substring(0,1); 
// oder 0,4  könnte 4.5 anstelle von nur 4 ausgeben
if (name == "Microsoft Internet Explorer")
{
 window.location=index-martin.html;
}
else
{
 window.location=index-martin-firefox.html;
}
</SCRIPT>


Danke

Tobias
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Mi 26.01.05 16:21 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
<script type="text/javascript" language="JavaScript">
function baz() {
 var name = navigator.appName;
 var vers = navigator.appVersion;
 vers = vers.substring(0,1); 
 // oder 0,4  könnte 4.5 anstelle von nur 4 ausgeben
 if (name == "Microsoft Internet Explorer")
 {
  window.location=index-martin.html;
 }
 else
 {
  window.location=index-martin-firefox.html;
 }
}
</script>
...
<img src="somefoo.png" onClick="JavaScript: baz()" alt="somefoo">


so...

wenn man den code ansieht, sieht man, dass es _nur_ mit PNGs geht *fgg*

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
Handycommander Threadstarter
ontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1054

Windows XP Pro, Vista
Visual Studio 2008
BeitragVerfasst: Mi 26.01.05 16:26 
klappt bei mir ned!

hast du noch ein anderes Beispiel, zur Browsererkennung, das funktioniert? Und das auch weiterleiten soll!

MfG

Tobias
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Mi 26.01.05 16:29 
Handycommander hat folgendes geschrieben:
klappt bei mir ned!


sehen lassen, wenn du nicht bereit bist, etwas mehr zu sagen :?

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
h0815
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Mi 02.02.05 12:53 
StefanH hat folgendes geschrieben:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
<script type="text/javascript" language="JavaScript">
function baz() {
 var name = navigator.appName;
 var vers = navigator.appVersion;
 vers = vers.substring(0,1); 
 // oder 0,4  könnte 4.5 anstelle von nur 4 ausgeben
 if (name == "Microsoft Internet Explorer")
 {
  window.location=index-martin.html;
 }
 else
 {
  window.location=index-martin-firefox.html;
 }
}
</script>
...
<a href="#" onclick="baz()"><img src="somefoo.png" border="0"></a>


so vielleicht?
[/size]
blackbirdXXX

ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1077
Erhaltene Danke: 1

Ubuntu Dapper

BeitragVerfasst: Mi 02.02.05 14:01 
h0815 hat folgendes geschrieben:
StefanH hat folgendes geschrieben:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
<script type="text/javascript" language="JavaScript">
function baz() {
 var name = navigator.appName;
 var vers = navigator.appVersion;
 vers = vers.substring(0,1); 
 // oder 0,4  könnte 4.5 anstelle von nur 4 ausgeben
 if (name == "Microsoft Internet Explorer")
 {
  window.location=index-martin.html;
 }
 else

 {
  window.location=index-martin-firefox.html;
 }
}
</script>
...
<a href="javascript:baz()"><img src="somefoo.png" border="0"></a>


so vielleicht?
[/size]


Und so?

_________________
Klein, schwarz und ärgert Techniker? Jumper!
Phobeus
ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1280

Linux (FC6), WinXP Pro (Box)
D6 Pers, D7 Pro, FPC 2.x
BeitragVerfasst: Mi 02.02.05 14:22 
IMAO nur als Einwurfe, wäre eine solche Browserkennung in den meisten Fällen besser in Form eines PHP-Skriptes aufgehoben, da damit auch jene Fälle sehr leicht behandelt werden könnten, die z.B. JavaScript deaktiviert haben. Nur ein kleiner gedanklicher Einwurf... ;)

_________________
"Menschen sterben nicht wenn man sie zu Grabe trägt, sondern wenn sie ihre Träume verlieren..."
blackbirdXXX

ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1077
Erhaltene Danke: 1

Ubuntu Dapper

BeitragVerfasst: Mi 02.02.05 16:08 
Phobeus hat folgendes geschrieben:
IMAO nur als Einwurfe, wäre eine solche Browserkennung in den meisten Fällen besser in Form eines PHP-Skriptes aufgehoben, da damit auch jene Fälle sehr leicht behandelt werden könnten, die z.B. JavaScript deaktiviert haben. Nur ein kleiner gedanklicher Einwurf... ;)


Oder per htaccess.

_________________
Klein, schwarz und ärgert Techniker? Jumper!
blackbirdXXX

ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1077
Erhaltene Danke: 1

Ubuntu Dapper

BeitragVerfasst: Mi 02.02.05 16:12 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
<script type="text/javascript">
function baz() {
    if (navigator.appName == "Microsoft Internet Explorer")
        document.location.href="index-martin.html";
    else
        document.location.href="index-martin-firefox.html";
}
</script>
...
<a href="javascript:baz()"><img src="foobar.png" border="0"></a>


Uuurrgh. Gerade erst gesehen. So solle es gehen.

_________________
Klein, schwarz und ärgert Techniker? Jumper!