Логин: Пароль:
Регистрация нового пользователя
Модератор: toedder 
 Computers

Have computer questions, hints, or tips?

BBW's Tips on how to speed up page load the brainking site
Computers (BIG BAD WOLF, 2007-03-12 20:16:01)



Что нового о Microsoft?
Список форумов
Режим: Каждый может объявить
Поиск в сообщениях:  

9. Июня 2007, 08:58:57
Übergeek 바둑이 
Субъект: Re: javascript and different browsers:
diogenysos:

I just read your message. I tested with two browsers. MS IE 6 is not my favorite, but it had no problem handling any of the scripts. Seamonkey 1.1.1 had no problems either. I used Sea Moneky in two machines. One is a Windows XP machine. The other is a Debian Linux machine. Both worked just fine. Linux comes with a browser called Koqueror. I tested with Konqueror 3.3.2 and the drop down menu works fine. However, the image swap failed.

First, about the drop-down menus. What browsers are causing problems? The reason why I don't like drop-down menus so much is because Mozilla browsers (that means Netscape, Fire Fox and Sea Monkey) handle DIV tags differently from the Microsoft browsers. Usually these drop down menus work by hiding and unhiding a DIV, and manipulating the Z-index to bring it to the front. Some work by positioning the DIV outside the normal screen margins so that it is not visible inside the normal computer display. Most of these require some checking of the browser version and they will manipulate the DIV differently depending on what browser is being used. You will have to read each individual browser documentation, and search out there for other versions of the drop-down menu to see if somebody has found a more stable approach.

About the image swap, I have found that this type of link is rather unstable:

<a href="javascript:swap('bild02','../images/coronasplaya1.jpg')">

For some reason some browsers have a hard time with inline Javascript like that. It works well in my XP machine with all browsers. My Linux machine failed with Koqueror as the browser.

Your Javascript function is perfectly correct and I have used a similar one before with great success and no problems in any browser:

function swap( bildname, tauschbild ) {
document.images[ bildname ].src = tauschbild;
}

Try replacing the links by a link like the ones below.

<a onMouseOver="swap( 'bild02' , '../images/coronasplaya1.jpg ' ); return true">
<a onClick="swap( 'bild02' , '../images/coronasplaya1.jpg ' ); return true">

Rather than having the Javascript inline in the HREF field, these use a mouse event such as the mouse moving over the link, or clicking the link. This type of link works great for swapping images. You can complete the tag by adding a target, and swapping to a different image when the mouse moves out of the link.

<a href="my_target.html" onMouseOver="swap( 'bild02' , '../images/coronasplaya1.jpg ' ); return true" onMouseOut="swap( 'bild02' , '../images/some_image.jpg ' ); return true">

I hope this helps.

Дата и время
Друзья в сети
Любимые форумы
Клубы
Советы
Копирайт © 2002 - 2024 Филип Рахунек, все права зарезервированы.
Наверх