473,785 Members | 3,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help convert code from IE to Mozilla

Hey Folks,

This code works in IE but not in Mozilla. I'd like it to work in both. I'm
sure it has something to do with the way I'm passing the anchor object but
I can't figure it out.
<SCRIPT TYPE='text/JavaScript'>
function GetTime(TimeAnc hor) {
today = new Date();
TimeAnchor.inne rHTML = today.toLocaleS tring();
delete today;
}
function UpdateTime(Time Anchor) {
GetTime(TimeAnc hor);
setInterval("Ge tTime(" + TimeAnchor.name + ")", 1000);
}
</SCRIPT>

<A NAME='DateTime' >
Clock should be here!
</A>

<SCRIPT TYPE='text/JavaScript'>
UpdateTime(Date Time);
</SCRIPT>

--
i.m.
The USA Patriot Act is the most unpatriotic act in American history.

Jul 23 '05 #1
5 1726
Internet Explorer plays a bit more loose with the DOM. You can fix the problem
on the invocation by:

UpdateTime(docu ment.getElement ById("DateTime" ));

This code works in IE but not in Mozilla. I'd like it to work in both. I'm
sure it has something to do with the way I'm passing the anchor object but
I can't figure it out.
<SCRIPT TYPE='text/JavaScript'>
function GetTime(TimeAnc hor) {
today = new Date();
TimeAnchor.inne rHTML = today.toLocaleS tring();
delete today;
}
function UpdateTime(Time Anchor) {
GetTime(TimeAnc hor);
setInterval("Ge tTime(" + TimeAnchor.name + ")", 1000);
}
</SCRIPT>
Clock should be here!
<SCRIPT TYPE='text/JavaScript'>
UpdateTime(Date Time);
</SCRIPT>


Jul 23 '05 #2
On Mon, 14 Jun 2004 16:45:07 +0000, ChrisRath wrote:
Internet Explorer plays a bit more loose with the DOM. You can fix the
problem on the invocation by:

UpdateTime(docu ment.getElement ById("DateTime" ));


Changing the code to:

<SCRIPT TYPE='text/JavaScript'>
function GetTime(TimeAnc hor) {
today = new Date();
TimeAnchor.inne rHTML = today.toLocaleS tring();
delete today;
}
function UpdateTime(Time Anchor) {
GetTime(TimeAnc hor);
setInterval("Ge tTime(" + TimeAnchor.id + ");", 1000);
}
</SCRIPT>
<A ID="DateTime">
Clock should be here!
</A>
<SCRIPT TYPE='text/JavaScript'>
UpdateTime(docu ment.getElement ById("DateTime" ));
</SCRIPT>

Updates the anchor with the time initially but the setInterval still
doesn't work in Mozilla.

Any ideas?

--
i.m.
The USA Patriot Act is the most unpatriotic act in American history.

Jul 23 '05 #3
It's the same sort of problem, in that IE exposes the id's at the top level
(which is not part of the DOM standard):

setInterval("Ge tTime(document. getElementById( '" + TimeAnchor.id + "'))", 1000);
Here's the example in entirety:

<html>
<head>
<title>test</title>
<script type='text/JavaScript'>
function GetTime(TimeAnc hor) {
today = new Date();
TimeAnchor.inne rHTML = today.toLocaleS tring();
delete today;
}
function UpdateTime(Time Anchor) {
GetTime(TimeAnc hor);
setInterval("Ge tTime(document. getElementById( '" + TimeAnchor.id + "'))",
1000);
}
</script>
</head>
<body>
<span id='DateTime'></span>
<script type='text/JavaScript'>
UpdateTime(docu ment.getElement ById("DateTime" ));
</script>
</body>
</html>
setInterval("Ge tTime(document. getElementById( 'TimeAnchor.id + ");", 1000);

On Mon, 14 Jun 2004 16:45:07 +0000, ChrisRath wrote:
Internet Explorer plays a bit more loose with the DOM. You can fix the
problem on the invocation by:

UpdateTime(docu ment.getElement ById("DateTime" ));


Changing the code to:

<SCRIPT TYPE='text/JavaScript'>
function GetTime(TimeAnc hor) {
today = new Date();
TimeAnchor.inne rHTML = today.toLocaleS tring();
delete today;
}
function UpdateTime(Time Anchor) {
GetTime(TimeAnc hor);
setInterval("Ge tTime(" + TimeAnchor.id + ");", 1000);
}
</SCRIPT>

Clock should be here!

<SCRIPT TYPE='text/JavaScript'>
UpdateTime(docu ment.getElement ById("DateTime" ));
</SCRIPT>

Updates the anchor with the time initially but the setInterval still
doesn't work in Mozilla.

Any ideas?

Jul 23 '05 #4
On Mon, 14 Jun 2004 18:16:21 +0000, ChrisRath wrote:
It's the same sort of problem, in that IE exposes the id's at the top
level (which is not part of the DOM standard):

setInterval("Ge tTime(document. getElementById( '" + TimeAnchor.id + "'))",
1000);
Here's the example in entirety:

<html>
<head>
<title>test</title>
<script type='text/JavaScript'>
function GetTime(TimeAnc hor) {
today = new Date();
TimeAnchor.inne rHTML = today.toLocaleS tring(); delete today;
}
function UpdateTime(Time Anchor) {
GetTime(TimeAnc hor);
setInterval("Ge tTime(document. getElementById( '" + TimeAnchor.id +
"'))",
1000);
}
</script>
</head>
<body>
<span id='DateTime'></span>
<script type='text/JavaScript'>
UpdateTime(docu ment.getElement ById("DateTime" ));
</script>
</body>
</html>


That appears to break the setInterval under both browsers... does this run
for you?

--
i.m.
The USA Patriot Act is the most unpatriotic act in American history.

Jul 23 '05 #5
On Mon, 14 Jun 2004 13:39:01 -0500, Ivan Marsh wrote:
That appears to break the setInterval under both browsers... does this run
for you?


Scratch that! Had a typo... now it works in both.

Thanks.

--
i.m.
The USA Patriot Act is the most unpatriotic act in American history.

Jul 23 '05 #6

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

Similar topics

3
1982
by: Chris | last post by:
Hi I have designed my website to fit my standard windows. I use a javascript scroller that nescitates the removal of the browser scroll bars. However if a user has an extra toolbar open in his browser like a google or yahoo toolbar or a links toolbar it pushes the content down and slightly out of view. I don't want to use a pop up window with toolbars=0 as this is often blocked by software. What I would like is to open the...
8
1939
by: Mike Gifford | last post by:
Hello, I've got a number of html fragments (in a template file) which are bundled together in a cms. I'm sure that there's a way through javascript to convert a piece of code like this: <!-- START BE_sectionNew-htmlarea2.tpl -->
5
1722
by: kj | last post by:
I have elements of the form <TD><A name="marker"></A>foobar</TD> and I want to extract the text "foobar". How can I do this in IE? (I think I know how to do it for NS). Is there a way to implement this that is reasonably browser-independent? Many thanks!
9
3039
by: YZK | last post by:
Hello. I'm not a Web developer, just a user, and I think I may have somehow messed myself up majorly. I'm not quite sure how. Right now, javascript used by websites I go to either does not work at all, or works sporadically. I'm talking about things like Hotmail, Yahoo Address Book, buttons on various sites, etc.. I'm a computer person, but not a Web OR Javascript person. Is there any way I can "start over again?" Can I, a Windows 98...
1
1485
by: Paul Gorodyansky | last post by:
Hi, More than a year passed since Netscape/Mozilla implemented what IE had since IE 5: http://www.faqts.com/knowledge_base/view.phtml/aid/1661 Is Opera still behind and does not allow re-assign keyCode? -- Paul
2
3409
by: Jon Smirl | last post by:
I only have a passing acquaintance with Python and I need to modify some existing code. This code is going to get called with 10GB of data so it needs to be fairly fast. http://cvs2svn.tigris.org/ is code for converting a CVS repository to Subversion. I'm working on changing it to convert from CVS to git. The existing Python RCS parser provides me with the CVS deltas as strings.I need to get these deltas into an array of lines so that...
6
3361
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in the past in other places, and while the help was much appreciated, it seemed everyone just wanted to 'theoretically' explain how to do it, but when I tried to do it myself, I couldn't login. I want to simply pass the email address and password to...
11
26640
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package and PEAR is in c:\wamp\php\pear I modified php.ini in the c:\wamp\php directory to reflect the actual path, but even stopping and restarting my server shows the c: \php5\pear path. I can't change it no matter what I do I also tried the...
8
1466
by: Tim Nash (aka TMN) | last post by:
Hi Can anyone help me match this div below - my regex does not work - if you could tell me why I would appreciate it. var aStr = "<div class='feedflare'>dfgdg dg</div>"; var reg = new RegExp("<div class='feedflare'.*?</div>'","gim"); thanks
0
9480
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
10315
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...
0
10147
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...
0
9947
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
8968
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
7494
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
5379
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...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
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.