Solved

setAttribute in Firefox

Posted on 2006-11-04
4
1,011 Views
Last Modified: 2012-05-05
The following script works perfectly in Internet explorer.
but it does nothing in FireFox. How can I modify it work
in FireFox too.

thanks for your help
--------------------------------------------------------------------------------
<style>
.imgCls {border: none;}
.imgClsClick {border: 1px solid black;}
</style>
<img src="japnuma.png" onmousedown="setAttribute('className', 'imgClsClick');" onmouseup="setAttribute('className', 'imgCls');" />
0
Comment
Question by:MnInShdw
  • 2
4 Comments
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 500 total points
ID: 17875238
MnInShdw,

Try using the code below.

<img src="japnuma.png" onmousedown="this.className='imgClsClick';" onmouseup="this.className='imgCls';" />

Let me know if this doesn't work in both.  Let me know if you have any questions or need more information.

b0lsc0tt
0
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 17875251
As an FYI, this works in FF:
<img src="japnuma.png" onmousedown="setAttribute('class', 'imgClsClick');" onmouseup="setAttribute('class', 'imgCls');" />

But will not work in IE :)

So use b0lsc0tt's version :)
0
 
LVL 1

Author Comment

by:MnInShdw
ID: 17875298
Million thanks for your quick help
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 17875335
Your welcome!  I'm glad that I could help.  Thank you for the grade, the points and the fun question.

bol
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now