473,624 Members | 2,249 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<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="">HEREHER EHERE</A> portion...
The HEREHEREHEREHER E 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="JAVAS CRIPT" 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="ima ges/opener-waterfall.gif" ALIGN="CENTER"
VALIGN="CENTER" BORDER="0" CELLPADDING="0" CELLSPACING="0" >
<TR>
<TD>

<TABLE BACKGROUND="non e.gif" ALIGN="CENTER" VALIGN="CENTER" >
<TR>
<TD CLASS="centerTD "><A HREF="index2.ht ml"><DIV
ID="Enter"></DIV></A></TD>
</TR>
</TABLE>

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

-----------------------------END CODE-------------------
Jul 23 '05 #1
5 1488
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="">HEREHER EHERE</A> portion...
The HEREHEREHEREHER E 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="JAVAS CRIPT" 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.getEle mentById("Enter ").childNod es[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="ima ges/opener-waterfall.gif" ALIGN="CENTER"
VALIGN="CENTER" BORDER="0" CELLPADDING="0" CELLSPACING="0" >
<TR>
<TD>

<TABLE BACKGROUND="non e.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.ht ml"><DIV
ID="Enter"></DIV>
Improper nesting. You can not have a block-level element within an
inline element.

<a href="index2.ht ml" id="idLangStrin g"></a>

and then

document.getEle mentById("idLan gString").child Nodes[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*********@dr n.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.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #5
Lee
Dr John Stockton said:

JRS: In article <cb*********@dr n.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
9596
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 customised attribute for <DIV> tag. Is that true? Thank you. Here is the code: <DIV class=Bar id=Bar1 menu="menu1" target='_top"' cmd="/app/login/ctrl.jsp?cmd=pipeline.main">Pipeline</DIV>
2
3520
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
1360
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 something to work in IE, but in Netscape there is a slight but obvious flicker. Is there some other way to do this or some solution to making this work? Try my Google referenced images below in IE and Netscape/Firefox and see what I am talking...
1
10311
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. Then, the user clicks submit on this child window, closing the child and sending the information back to the parent. That part works. Now, I want to have the parent window change the innerHTML of a div tag that I have nested in the table like...
1
8102
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
402
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 dynamically in the code-behind. Each table should go to its own <div> tag. The reason that I can't have the <div> tags in aspx is that the number of the tables is unknown until runtime and each table should go into its own <div> tag. How is this...
1
2422
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 invalid for a strict implementation. <spanis in-line-level and <divis block-level. I don't want to mix up <span> and <div> I'm using an <asp:Buttonhere because when it switches to the URL I need to check that the user is in the correct role -...
1
1418
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
1691
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); onmouseover="zoom_on(event,325,407,'<%= strLeftImage %>');" style="FLOAT: left" onmouseout=zoom_off();> <div id="divOuterleft" style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; Disable:True PADDING-BOTTOM: 0px; MARGIN: 0px; OVERFLOW: auto; WIDTH: 325px; PADDING-TOP:...
10
5376
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 designed byDIV tags. My code in that user control is somehting like.. ---------------------------- <DIV> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:TextBox ID="TextBox1" runat="server" Width="160px"></asp:TextBox>
0
8170
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8675
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8334
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6108
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2604
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.