Archive for the 'Javascript' Category

Fehlerfreies einbinden von flash (swf)

Wednesday, March 26th, 2008

Es gibt doch etliche Standards die alle behaupten dass Sie richtig sind und am Ende wird das verwendet was diverse tools ausspucken, sei es ein klein swf animations tool oder das eigendliche Flash von Adobe (Macromedia).

Das HTML das mitgeliefert wird ist manchmal bedenklich, doch jeder verwendet es, da es ja funktioniert, wenn es auch WARNINGS erzeugt. Also was tun.

Ich hab mir mal das swfObject Projekt angeschaut und was die Jungs gemacht haben macht mal richtig Sinn und es gibt auch noch zusatz Funktionen die mit eingebaut sind, so wie das automagische aktivieren eines eingebunden swf Files im IE ohne Benutzeraktivierung.

Die gute alte Flash abfrage endlich mal richtig gemacht mit der möglichkeit den Benutzer gleich zum installieren zu schicken ODER einfach alternativen Inhalt an zu zeigen, wie man es bevorzugt.

Alles in allem eine gute Lösung die funktioniert.

Quick Javascript Check for IE

Wednesday, April 12th, 2006

Actually this wouldn’t be a big thing or anything, but there is one little thing that one needs to be aware of – OPERA! Opera can disguise itself as IE and that way pending on the user it can easily happen that in browserchecks the user get’s sent the wrong way.

As mentioned above, this is quick an dirty, for real detection the script nees to be far longer and quite frankly one should only resort to a browser check if one can absolutely NOT solve the problem another way, as there is always a chance that a browser or specific browser version get’s sent the wrong way or not sent anywhere at all.

So here is the code:

document.write("User Agent Name:
");

if (navigator.userAgent.indexOf('Opera') != -1) {
document.write("Opera");
}
else {
document.write(navigator.appName);
}

document.write("

Reiner IE Check:
");
if ((document.all) && (navigator.userAgent.indexOf('Opera')== -1))
{
document.write("IE");
} else {
document.write("not IE");
}

You can now modify it to your needs to switch whatever you need to.

Javascript – Change Link Color

Wednesday, March 22nd, 2006

Es gibt wahrscheinlich etliche Möglichkeiten und etliche Variationen hierfür, aber hier ist mal die, die ich verwende. Es geht ja hauptsächlich darum das man eine Anzahl von Links hat, mit hoover hat man schon über CSS sein MouseOver gehandhabt aber jetzt fehlt halt noch etwas für aktive. Ja es gibt ja auch aktive für CSS, doch mal ehrlich in wievielen Browsern tut das und in welchen wenn man es über ein Frameset springen läßt.

Also lange rede kurzer sinn, hier erst mal ein Link zur Test Seite, ihr könnt Euren a und a:hoover dann noch selber definieren und dann hier der Code für den Rest:

Das Javascript:

    <script language="JavaScript" type="text/javascript">
    <!--

    var oldobj = "";

    function fett(obj)
    {
    if (oldobj != "")
    {
    oldobj.style.color="0033FF";
    oldobj.style.fontWeight="normal";
    }
    obj.style.color="555555";
    obj.style.fontWeight="bold";
    oldobj = obj;
    }

    //-->
    </script>

Der Link im Body:

    <a href="#" onclick="JavaScript:fett(this);">blabla</a>