Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > problem on netscape 7.0 with javascript

Reply
Thread Tools

problem on netscape 7.0 with javascript

 
 
WL Yang
Guest
Posts: n/a
 
      11-04-2004
Hi all,

I am green in javascripts, and facing one problem during waiting web
page. I want to display an image dynamitically in the page and use the
sentences below.

..............
..............
<script language="javascript">
if (document.layers) {
document.write("<img src='" + pics[0] + "' border=1 width=760
height=600 name='displayPic'>");
} else {
showPic(thePic,theSize);
}
........................
................

and it call this function;

function showPic(whichPic,whichSize) {
theSize = whichSize;
if (whichSize == "small") {
var content = "<img src='"+picsS[whichPic]+"' border=1
name='displayPic'>";
}
else {
var content = "<img src='"+picsL[whichPic]+"' border=1
width=760 height=600 name='displayPic'>";
}
}
if (isIE) {
document.all("picDiv").innerHTML = content;
}
if (isNS6) {
document.getElementById("picDiv").innerHTML = content;
}
showPicTime(whichPic);
}

I found that the same image will show twice ( they lies upward and
downward ) on the page when using netscape 7.0 but it will not when
using netscape 7.2 or IE.

am I writing some wrong inside the scripts? or the statement really
display it twice?

thks in advance.

wlyang
 
Reply With Quote
 
 
 
 
kaeli
Guest
Posts: n/a
 
      11-04-2004
In article < >,
enlightened us with...
> Hi all,
>
> I am green in javascripts,


Want some constructive advice then?
Stop doing browser detection.

> <script language="javascript">


The language attribute is deprecated in favor of the type attribute. If you
have to support old browsers, it doesn't hurt to use both.
<script type="text/javascript" language="javascript">

> if (document.layers) {
> document.write("<img src='" + pics[0] + "' border=1 width=760
> height=600 name='displayPic'>");


Are you sure that's what you want?
I'm not sure where in the page this script is running, but usually one sees
document.layers["layername"].document.write("some string");
for NN4.

>
> function showPic(whichPic,whichSize) {
> theSize = whichSize;
> if (whichSize == "small") {
> var content = "<img src='"+picsS[whichPic]+"' border=1
> name='displayPic'>";
> }


This really isn't the best way to make new pics.
Let me know if you are curious about alternatives using createElement or new
Image().

> else {
> var content = "<img src='"+picsL[whichPic]+"' border=1
> width=760 height=600 name='displayPic'>";
> }
> }
> if (isIE) {
> document.all("picDiv").innerHTML = content;


I don't know what isIE is, but Opera also supports document.all.
This is better:

if (document.all && !document.getElementById)
document.all("picDiv").innerHTML = content;

> }
> if (isNS6) {
> document.getElementById("picDiv").innerHTML = content;


I don't know what isNS6 is, but this is better:
if (!document.all && document.getElementById)
document.getElementById("picDiv").innerHTML = content;

> }
> showPicTime(whichPic);


What is this function doing? Hard to trace problems without all the code.

> }
>
> I found that the same image will show twice ( they lies upward and
> downward ) on the page when using netscape 7.0 but it will not when
> using netscape 7.2 or IE.


7.0 is buggy. I've had numerous problems with it.
I'd need to see a full testable page to play with to say any more about that.
Got a URL with a full test example?

My guess: it's appending instead of replacing. But I dunno for sure.

--
--
~kaeli~
The man who fell into an upholstery machine is fully
recovered.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

 
Reply With Quote
 
 
 
 
WL Yang
Guest
Posts: n/a
 
      11-06-2004
kaeli <> wrote in message news:<>. ..
> In article < >,
> enlightened us with...
> > Hi all,
> >
> > I am green in javascripts,

>
> Want some constructive advice then?
> Stop doing browser detection.
>
> > <script language="javascript">

>
> The language attribute is deprecated in favor of the type attribute. If you
> have to support old browsers, it doesn't hurt to use both.
> <script type="text/javascript" language="javascript">
>
> > if (document.layers) {
> > document.write("<img src='" + pics[0] + "' border=1 width=760
> > height=600 name='displayPic'>");

>
> Are you sure that's what you want?
> I'm not sure where in the page this script is running, but usually one sees
> document.layers["layername"].document.write("some string");
> for NN4.
>
> >
> > function showPic(whichPic,whichSize) {
> > theSize = whichSize;
> > if (whichSize == "small") {
> > var content = "<img src='"+picsS[whichPic]+"' border=1
> > name='displayPic'>";
> > }

>
> This really isn't the best way to make new pics.
> Let me know if you are curious about alternatives using createElement or new
> Image().
>
> > else {
> > var content = "<img src='"+picsL[whichPic]+"' border=1
> > width=760 height=600 name='displayPic'>";
> > }
> > }
> > if (isIE) {
> > document.all("picDiv").innerHTML = content;

>
> I don't know what isIE is, but Opera also supports document.all.
> This is better:
>
> if (document.all && !document.getElementById)
> document.all("picDiv").innerHTML = content;
>
> > }
> > if (isNS6) {
> > document.getElementById("picDiv").innerHTML = content;

>
> I don't know what isNS6 is, but this is better:
> if (!document.all && document.getElementById)
> document.getElementById("picDiv").innerHTML = content;
>
> > }
> > showPicTime(whichPic);

>
> What is this function doing? Hard to trace problems without all the code.
>
> > }
> >
> > I found that the same image will show twice ( they lies upward and
> > downward ) on the page when using netscape 7.0 but it will not when
> > using netscape 7.2 or IE.

>
> 7.0 is buggy. I've had numerous problems with it.
> I'd need to see a full testable page to play with to say any more about that.
> Got a URL with a full test example?
>
> My guess: it's appending instead of replacing. But I dunno for sure.
>
> --



Dears,

thks for yr reply. in facts I got this script from others and really
not know this much. and also thks for telling 7.0 is buggy.^-^

Rgds,
yang
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Netscape 7.1 to Netscape 8 Skid Schermerhorn Firefox 2 09-05-2005 04:04 PM
Can't access Netscape mail with Netscape email client anymore. Mark Adams Computer Support 6 03-14-2005 03:31 PM
Accessing Netscape mail via Netscape mail client A. Toprak Computer Support 0 12-24-2004 06:46 AM
Netscape with JRE 1.5 beta 1 ignores Netscape signing Mickey Segal Java 1 05-21-2004 01:52 PM
websphere, oracle, netscape: netscape timeout Tom Java 0 08-01-2003 11:03 PM



Advertisments