473,796 Members | 2,788 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Document definition problem with firefox

150 New Member
Hi everyone.

I'm having problem with firefox only but it works when i delete document definition that is my code:

[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitl ed Document</title>
</head>
<script language="javas cript">
function coloringText(){
var allText=documen t.getElementsBy TagName("input" );
for(i=0;i<allTe xt.length;i++){
var type=allText[i].getAttribute(" type");
if(type=='text' || type=='password '){
var thisElement=all Text[i];
allText[i].style.border=" 1px solid #999";
allText[i].style.backgrou ndColor="#FFF";

allText[i].onfocus=functi on Coloring(){
this.style.bord er="1px solid #98C9FE";
this.style.back groundColor="#F 4FAFF";
document.getEle mentById('info' ).style.display =''
document.getEle mentById('info' ).innerHTML = this.alt
var coords = getCoords(this) ;
document.getEle mentById('info' ).style.top = coords.y - 10
document.getEle mentById('info' ).style.left = coords.x + 180
}
allText[i].onblur=functio n Coloring(){
this.style.bord er="1px solid #999";
this.style.back groundColor="#F FF";
document.getEle mentById('info' ).style.display = 'none'
}
}
}
}
function getCoords(eleme nt){
var coords = { x: 0, y: 0, width: element.offsetW idth, height:element. offsetHeight };
while (element) {
coords.x += element.offsetL eft;
coords.y += element.offsetT op;
element = element.offsetP arent;
}
return coords;
}
</script>
<body onload="colorin gText();">
<form id="form1" name="form1" method="post" action="">
<div id="info" style="display: none; position:absolu te; background:#BBB BBB; padding:10px; color:#FFFFFF;" ></div>
<table width="700" border="0" align="center" cellpadding="3" cellspacing="3" >
<tr>
<td width="146"><in put type="text" name="textfield " id="textfield" alt="hello people!!"/></td>
</tr>
<tr>
<td><input type="text" name="textfield 2" id="textfield2 " alt="text hello human!!"/></td>
</tr>
<tr>
<td><input type="text" name="textfield 3" id="textfield3 " alt="hello people!!"/></td>
</tr>
<tr>
<td><input type="text" name="textfield 4" id="textfield4 " alt="hello people!!"/></td>
</tr>
</table>
</form>
</body>
</html>[/HTML]

Many thanks.
Mar 11 '08 #1
4 1484
smartic
150 New Member
Any help please on my problem will be appreciated many thanks for this wonderful Site and Admins :)
Mar 12 '08 #2
acoder
16,027 Recognized Expert Moderator MVP
Don't forget the measurements/sizes, e.g. "px".
Mar 12 '08 #3
drhowarddrfine
7,435 Recognized Expert Expert
<script> needs to be in the <head>
It is also supposed to be <script type="text/javascript">
Mar 12 '08 #4
acoder
16,027 Recognized Expert Moderator MVP
<script> needs to be in the <head>
Looked at the JavaScript code and missed the obvious one! smartic, this would be spotted if you validated the page.
Mar 12 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
9846
by: Catherine Lynn Smith | last post by:
I am creating a webpage with dhtml <DIV> layers and I want a link on one layer to modify the content on another but I seem to keep running into errors. Basically I create a layer in the middle of the screen that initially comes up with a gif image of a house: <!-- start "house" layer definition for center of screen --> <DIV id="house" style="position:absolute; left:140px; top:137px; width:510px; height:325px; z-index:2"><img...
6
3694
by: skubik | last post by:
Hi everyone. I'm attempting to write a Javascript that will create a form within a brand-new document in a specific frame of a frameset. The problem is that I can create the form and input element using createElement(), but when I go to append the form element into the new document, the script halts and I get the following error in my Javascript Console (Firefox 1.0): __tmp_newDoc.body has no properties.
10
54907
by: InvisibleMan | last post by:
Hi, Thanks for any help in advance... Okay, I have the JS listed below that calls for the display of the (DIV) tag... cookie function not included, as don't feel its necessary but you'll get the idea! function closeall() { var objs;
136
9460
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
7
2409
by: Andrea | last post by:
Hi there - I'm hoping someone can help me; I've been struggling with this for a few days! :-) I have a webpage that is comprised of many forms containing questions. As the user answers one of the questions, that form is hidden and the next is displayed. Also, as the user answers each question a "count" variable is updated based on their response. I would like the question to show up on the left side and the answer to show up in the...
8
3753
by: johnsonlau | last post by:
When I use document.write to replace the comment of a frame, I found that the page was always showing as loading in Firefox (2.0.0.2). But it seems that it is OK in IE6. Could someone help me with this problem? Thanks. My file: <html>
13
2628
by: Gretsch | last post by:
Re XML, Javascript, IE, Firefox Hi, I have a very simple & small XML file (only 7 variables). The code works for IE, but not for Firefox. I've search around and found lots of alternatives, but all different and mostly way above my competance level to understand (ieg Ajax;-(). Could someone give me some guidance please. - thanks var xmlDoc; // Code for IE if (window.ActiveXObject) { document.write("IE detected<br>");...
5
2971
by: SuneR | last post by:
Hi, I am having problems figuring out how to make Firefox behave, and output the HTML I want it to output. The thing I want done is actually quite simple. I have a <labeltag, and inside it, I have a script tag, that document.write's some HTML. Like this:
0
9533
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
10239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10190
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,...
0
10019
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9057
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7555
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
6796
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
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2928
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.