Click to See Complete Forum and Search --> : Moving Images in NS4.x? Please help!


mplutodh1
06-01-2003, 08:42 PM
So I have this script, moving two images, the first image moves from the bottom right to the upper left and then the upper left to the center. It works in IE but not in NS, can anyone assist me? I am new to DOM and I am struggling with getting things to work in NS. Thanks

http://www.ac.wwu.edu/~pludem/cs202/project2003/intro.htm

http://www.ac.wwu.edu/~pludem/cs202/project2003/intro.js

mplutodh1
06-01-2003, 09:54 PM
Anyway to add a browser sniffer type of if statement and get it to do something different in NS?

if (navigator.appVersion.indexOf("4.") == -1)
alert("This document requires a 4.0 or later browser.");
if (navigator.userAgent.indexOf("MSIE") > -1)
browser="ie";
else
browser="netscape";

maybe something like that, with the appropriate relationships?

mplutodh1
06-01-2003, 10:45 PM
Dave I appreciate the help! That was what I was thinking, so where would I go about putting this though? would it go at the beginning of the intro.js?

Khalid Ali
06-02-2003, 12:23 AM
Originally posted by Dave Clark
[code]
if (document.getElementById) {
if (document.all) {
// code for IE5+
} else {
// code for NS6+
}

Dave

document.all will pass as IE 6 as well,to make it diferentiate between IE6 and lower browsers

this test will work
if(document.all && document.documentElement){
//IE6+
}else if(document.all && !document.documentElement){
//<=IE5.5
}

gil davis
06-02-2003, 07:14 AM
Here is an example that I wrote of moving things around:

http://gil.davis.home.att.net/followmouse.htm

When you mousedown inside the yellow box and then drag, the box follows the mouse. When you mouseup, the box stops moving. I hope this example will give you an idea of how to move an image or other object in NS 4. It also works in DOM compliant browsers like IE5+ and NS6+. It does not support IE4.

Khalid Ali
06-02-2003, 07:52 AM
Originally posted by gil davis
It also works in DOM compliant browsers like IE5+ and NS6+. It does not support IE4.

FYI....

I tested it with..NS7 and Mozilla 1.3...

the block on which you are supposed to click your mouse,doesn't even show....need fixing I guess...:-)

gil davis
06-02-2003, 05:58 PM
the block on which you are supposed to click your mouse,doesn't even showIt i the style. I must have forgotten to retest after I got IE to work. I was having scroll bar problems when you move the box to the right or the bottom edges.

I changed it to "overflow: hidden" and that satisfed NS6. Can you give it a try in NS7 again for me?

It still acts strange when you try to drag the box off the right or bottom edges. The box changes, trying to keep from falling off the edge.

http://gil.davis.home.att.net/followmouse.htm