Load diff. image depending on browser

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

Hello,
trying to do something with javascript. didn't feel like using perl to do it.. wanted to learn how to do it with javascript.

I want to be able to load diff. images depending on which browser. Hehe..simple one eh. Tell me if this code would work.

<script language="JavaScript">

</script>

I know this can be cleaned up alot better. This is only like my 4th time messing trying to code javascript myself. I usually have someone else for that.

Thanks for any help I can get.

Pimpin like a pimp with an electrofied pimpin machine!

AndyB's picture

They have: 344 posts

Joined: Aug 1999

Dunno about yours, but this one works:)

<script>

if (!document.all)
document.write("")
else
document.write("")

</script>

They have: 122 posts

Joined: Jun 1999

Hey, we got a topic almost exactly like this yesterday, you guys the same people?

http://javascriptcity.com/forums/showthread.php3?threadid=1976

aDog Cool

They have: 6 posts

Joined: Oct 2000

Your problem in your code is this :
instead of document.write("/images/..."
put this document.write("

They have: 74 posts

Joined: Sep 2000

<script language="JavaScript">
")
}
else if (navigator.appName == "Microsoft Internet Explorer") {
document.write("")
}

// -->
</script>

You made a few that you didn't define(i think) anyway you can add more for the other browser names(i cant think of the other browser names, though)
I've done things like this a few times so this code should work, if not, drop me a line(preferrably by email).

Goodbye,
I
a
n

hehe

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.