Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 28th, 2006, 10:27 AM
Authorized User
 
Join Date: Jun 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default how with firefox

javascript code is not working with firefox, the simple
example is the following which is not working :

<a href="#" onclick="alert();">hiiii</a>

any other script requirements for firefox??
note: enable javascript checkbox in firefox settings is checked.

 
Old December 28th, 2006, 10:47 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi akkad,

It "doesn't work" because you're not really alerting anything. Try this instead:

<a href="#" onclick="alert('anything');">hiiii</a>

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old December 28th, 2006, 11:02 AM
Authorized User
 
Join Date: Jun 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thnx but what about this:

<html>
<head>
<title>aaa</title>
<script type="text/javascript">
function ff()
{
 document.all.fnt.innerText = "fffff";
}
</script>
</head>
<body>
kjhkj
</body>
</html>

 
Old December 28th, 2006, 11:24 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

document.all is IE only. You need document.getElementById instead and forget about document.all (unless you want to distinguish between IE and all other browsers). You also need to use innerHTML instead of innerText:

 document.getElementById('fnt').innerHTML = "fffff";

http://blog.coderlab.us/2005/09/22/u...-with-firefox/

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old December 28th, 2006, 11:45 AM
Authorized User
 
Join Date: Jun 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

now u helped me, thnx alot.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox 1.5 enjoysolutions BOOK: Professional Ajax ISBN: 978-0-471-77778-6 1 March 13th, 2006 10:34 AM
firefox / IE flipo Beginning PHP 7 November 8th, 2005 12:38 PM
Firefox brucen BOOK: Accessible XHTML and CSS Web Sites: Problem Design Solution 0 October 26th, 2005 12:38 PM
firefox Vs IE fred_brie HTML Code Clinic 1 February 22nd, 2005 04:12 PM
Firefox Hunter Linux 1 February 22nd, 2005 12:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.