473,240 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,240 software developers and data experts.

<DIV>tag in netscape? but works in IE (see code)

D E
Here is the problem. The following script/html code works in IE, not
Netscape. The javascript portion produces the text to be dynamically written
in the
<A HREF="">HEREHEREHERE</A> portion...
The HEREHEREHEREHERE writes fine in internet explorer, but does not appear
at all in Netscape 7.1. I think it might have something to do with layers...
How do I correct this? Thanks.
-----------------------JAVASCRIPT PORTION:----------------------------------
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="text/javascript">
<!---
function produceEnter() {
//produces a random number between 1 and 8
intInt = Math.round(Math.random() * 7 + 1);

switch(intInt) {
case 1: //Spanish
langString = "[ENTRE](spanish)";
break;
case 2: //French
langString = "[ENTRER](french)";
break;
case 3: //German
langString = "[TRAGEN SIE EIN](german)";
break;
case 4: //Italian
langString = "[ENTRARE](italian)";
break;
case 5: //Dutch
langString = "[GA BINNEN](dutch)";
break;
case 6: //Portuguese
langString = "[ENTRE](portuguese)";
break;
case 7: //English
langString = "[ENTER](english)";
break;
case 8: //Norwegian
langString = "[GÅ INN I](norwegian)";
break;
default: //English
langString = "[ENTER](english)";
break;
}
Enter.innerHTML = langString;

}
--->
</SCRIPT>
-----------------------------HTML PORTION-----------------------
<TABLE BACKGROUND="images/opener-waterfall.gif" ALIGN="CENTER"
VALIGN="CENTER" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD>

<TABLE BACKGROUND="none.gif" ALIGN="CENTER" VALIGN="CENTER">
<TR>
<TD CLASS="centerTD"><A HREF="index2.html"><DIV
ID="Enter"></DIV></A></TD>
</TR>
</TABLE>

</TD>
</TR>
</TABLE>

-----------------------------END CODE-------------------
Jul 23 '05 #1
5 1455
DU
D E wrote:
Here is the problem. The following script/html code works in IE, not
Netscape. The javascript portion produces the text to be dynamically written
in the
<A HREF="">HEREHEREHERE</A> portion...
The HEREHEREHEREHERE writes fine in internet explorer, but does not appear
at all in Netscape 7.1. I think it might have something to do with layers...
How do I correct this? Thanks.
-----------------------JAVASCRIPT PORTION:----------------------------------
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="text/javascript">
Language is deprecated; type has superseded language and is both
backward and forward compatible.
<!---
Commenting out script code is unneeded unless you're looking to support
*very* old browsers.
function produceEnter() {
//produces a random number between 1 and 8
intInt = Math.round(Math.random() * 7 + 1);

switch(intInt) {
case 1: //Spanish
langString = "[ENTRE](spanish)";
break;
case 2: //French
langString = "[ENTRER](french)";
break;
case 3: //German
langString = "[TRAGEN SIE EIN](german)";
break;
case 4: //Italian
langString = "[ENTRARE](italian)";
break;
case 5: //Dutch
langString = "[GA BINNEN](dutch)";
break;
case 6: //Portuguese
langString = "[ENTRE](portuguese)";
break;
case 7: //English
langString = "[ENTER](english)";
break;
case 8: //Norwegian
langString = "[GÅ INN I](norwegian)";
break;
default: //English
langString = "[ENTER](english)";
break;
}
Enter.innerHTML = langString;
document.getElementById("Enter").childNodes[0].nodeValue = langString;

will work in MSIE 5+, NS 6.2, NS 7.x, Mozilla-based browsers, Konqueror
3.x, Safari 1.x, etc..
}
--->
</SCRIPT>
-----------------------------HTML PORTION-----------------------
<TABLE BACKGROUND="images/opener-waterfall.gif" ALIGN="CENTER"
VALIGN="CENTER" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD>

<TABLE BACKGROUND="none.gif" ALIGN="CENTER" VALIGN="CENTER">
No need for a nested table here. You just make the markup code more
complex, longer to parse, load and render.
<TR>
<TD CLASS="centerTD"><A HREF="index2.html"><DIV
ID="Enter"></DIV>
Improper nesting. You can not have a block-level element within an
inline element.

<a href="index2.html" id="idLangString"></a>

and then

document.getElementById("idLangString").childNodes[0].nodeValue =
langString;

will work again in will work in MSIE 5+, NS 6.2, NS 7.x, Mozilla-based
browsers, Konqueror 3.x, Safari 1.x, etc.. and in other W3C compliant
browsers.

You have many web design and markup syntax problems to deal with in that
code. None of your tables seems justified since you don't have tabular
data to render in the first place.

DU

</A></TD> </TR>
</TABLE>

</TD>
</TR>
</TABLE>

-----------------------------END CODE-------------------

Jul 23 '05 #2
Lee
D E said:

//produces a random number between 1 and 8
intInt = Math.round(Math.random() * 7 + 1);


In addition to the other problems that have been
pointed out, this line returns 1 and 8 only half
as often as any of the other values.
The correct code is:

intInt = Math.floor(Math.random()*8+1);

Jul 23 '05 #3
Lee wrote:
D E said:
//produces a random number between 1 and 8
intInt = Math.round(Math.random() * 7 + 1);

In addition to the other problems that have been
pointed out, this line returns 1 and 8 only half
as often as any of the other values.


Quite right, a simple check would demonstrate this.

http://www.mickweb.com/demo/notRandom.html

Mick
The correct code is:

intInt = Math.floor(Math.random()*8+1);

Jul 23 '05 #4
JRS: In article <cb*********@drn.newsguy.com>, seen in
news:comp.lang.javascript, Lee <RE**************@cox.net> posted at Mon,
21 Jun 2004 06:35:48 :
D E said:
//produces a random number between 1 and 8
intInt = Math.round(Math.random() * 7 + 1);


In addition to the other problems that have been
pointed out, this line returns 1 and 8 only half
as often as any of the other values.
The correct code is:

intInt = Math.floor(Math.random()*8+1);

It would be useful to refer to the FAQ. Your answer of course covers
the current point; but who knows what else the OP might learn from
reading the FAQ? BTW, your solution does not address the bug in Opera.

The OP cross-posted excessively; therefore I do not see more than his
header, nor that of DU's reply. Cross-posting to more than two or three
groups can diminish readership.

<FAQENTRY> In section 4.22, "between" should be "in the range" or
similar. Between 1 & 3 there is only 2.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> JL / RC : FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #5
Lee
Dr John Stockton said:

JRS: In article <cb*********@drn.newsguy.com>, seen in
news:comp.lang.javascript, Lee <RE**************@cox.net> posted at Mon,
21 Jun 2004 06:35:48 :
D E said:
//produces a random number between 1 and 8
intInt = Math.round(Math.random() * 7 + 1);


In addition to the other problems that have been
pointed out, this line returns 1 and 8 only half
as often as any of the other values.
The correct code is:

intInt = Math.floor(Math.random()*8+1);

It would be useful to refer to the FAQ. Your answer of course covers
the current point; but who knows what else the OP might learn from
reading the FAQ? BTW, your solution does not address the bug in Opera.


I had intended to point to the FAQ. That was an oversight.
I'm torn on the Opera bug, leaning towards letting it fail.
Of course, nobody who uses my production code uses Opera.

Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: chirs | last post by:
Hi, What are the menu and cmd attributes in the following code? I could not find the information for these two attributes to be used in a <DIV> tag. Someone told me that you can define...
2
by: Matthew | last post by:
Hello! What is the best NS/IE compliant way to accomplish this using the least amount of javascript code? <div id="block1"> Group 1 Code </div> <div id="block2"> Group 2 Code </div>
5
by: Julia Briggs | last post by:
Is there a <a href="javasc... approach to switch between two images inside a div tag so it doesn't slightly flicker when clicked on, and transitions between images smoothly in Netscape? I can get...
1
by: Sean | last post by:
I have a table (with tabular data) that I want to display on a webpage. Initially the talbe is empty. When a user clicks on a button, a child window opens up with a form and some text fields. ...
1
by: Kenneth | last post by:
This is probably very simple question but how do you access elements inside the <div> tag? I need to access the value of a textfield inside a <div> tag. Thanks.
1
by: DJ Dev | last post by:
Hi All, I would like to add the <div> tag programatically from the code-behind of my aspx file. Basically, I would like to a table to this <div>. There are a number of tables which are created...
1
by: mark4asp | last post by:
<form runat="server"automatically adds <divtag to code contained within. Is there a way to stop that? Mixing block-level elements with inline-level elements messes up the HTML becasuse that is...
1
by: menmysql | last post by:
hi to all i want to place a division(using <div> tag) at a perticular location(x,y). is it possible. if possible please tell me how to do it. regards
0
by: veera venkata | last post by:
hi i am using the following code to provide the zoom,scroll for a image. but this code is working individually either scrolling or zooming. <div onmousemove=zoom_move(event);...
10
by: Manikrag | last post by:
Hi Team, I searched a lot on this but could not find anything, so I am posting it here. I am using an AutoCompleteExtender in a user control which is in a master page. The page layout is...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.