logo

Is a colour-picker any use?

There seems to have been lots of talk of the greatness of Mozilla recently. Without doubt it's a great browser, but this doesn't change the fact that most of still spend most of our time developing for IE, and only IE. This is the case isn't it? Or am I out of touch now?

Here's a little IE 6 only tip that may come in useful - a colour picker for your web page. If you're using IE now you should see a button below this paragraph. If you're using any other browser it should be hidden (to do this I used conditional comments). Click the button and you should see the standard Windows colour picker dialog. Choose a colour and it will set this page's background colour to match.

To do this you first need to add the dialog-helper object to the page. Embed the following HTML on your page:

<object id="dlghelper" width="0px" height="0px"
classid="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b">

</object>

You can then use the following JavaScript method to call the dialog box:

document.getElementById("dlghelper").choosecolordlg();

The returned value is the decimal representation of the chosen colour. You can use this to do what you like e.g. set a field value to store the chosen colour. Maybe it would be useful on a site where the colours are customisable by the end user. Whether or not you can think of use, I don't know. Just remember it's on codestore somewhere whenever you do ;o)

Comments

  1. Function to convert the return value to hex:

    function dectohex(decvalue){

    try{

    decvalue=decvalue.toString(16);

    if (decvalue.length<6) {

    var tmpstr="000000".substring(0,6-decvalue.length);

    decvalue=tmpstr.concat(decvalue);

    }

    return decvalue;

    }catch(e){

    alert('Error, bla bla bla');

    }

    }

    • avatar
    • Trent
    • Mon 14 Jun 2004 06:48 AM

    I get "A Runtime Error Has Occurred" when clicking on the button in IE5.5

    • avatar
    • Jake
    • Mon 14 Jun 2004 07:29 AM

    Sorry about that Trent. Didn't bother testing in anything but IE6. Shame on me. I'll see if I can't fix it now.

    • avatar
    • Jake
    • Mon 14 Jun 2004 07:48 AM

    Woops. It's IE 6 only folks! Sorry about that.

    • avatar
    • Allen
    • Mon 14 Jun 2004 10:41 AM

    Is this for r6 only?

    • avatar
    • Jake
    • Mon 14 Jun 2004 12:16 PM

    IE 6 only Allen. Doesn't matter which version of Notes you use as I'm talking, as always, about browser-based stuff.

    • avatar
    • Tom
    • Mon 14 Jun 2004 03:10 PM

    Thanks Jake! I always wanted a pink Codestore page!

    Nice work! I'm sure many of us will find even more ways to tick off end users with this little nugget of knowledge. :)

  2. Now how many of us went and changed the background to pink after reading that...

  3. Ah, but WHICH pink did we choose?

    • avatar
    • John Foldager
    • Tue 15 Jun 2004 10:10 AM

    Jake I believe that the statistics show that 95% (or even more) of the Internet users uses IE for browsing. The statistics are probably true, but I have one view of this.

    I think it is because whenever people like me uses Opera, Mozilla, Mozilla Firefox (or whatever browser we choose beside IE) we hit into IE-only pages and get the message "You're not running IE. Please click here to download the newest IE to view this site".

    Is that user-friendly? No I think not.

    The problem is that most website developers creates websites without testing in other browsers but IE. It actually isn't that hard to make a site work in other browsers, and even on other browsers not running under Windows.

    What if we switched and used the W3 CSS standards to make page source smaller and this way also made pages that should work in any browser on any platform? Well... then IE is by far the most faulty browser on the marked today.

    So my question would be... why are people still using only IE to browse and to test???

    PS. I also use IE on my Windows machine, but also Opera, Mozilla and Mozilla Firefox on Windows, Linux and Solaris...

    PPS. I really liked the comment from Trent saying that this didn't work in IE5.5....... Think about that one everyone.

    PPPS. Beside you being an IE guy, this is still a great site ;o)

    • avatar
    • Jake
    • Tue 15 Jun 2004 11:58 AM

    John, I'm not an IE guy by any means. I am writing this reply in Firefox, which I use for most of my browsing nowadays.

    I talk about IE so much merely because I assume most of us develop for intranets where most browsers are *set* as IE. No?

    • avatar
    • John Foldager
    • Tue 15 Jun 2004 01:02 PM

    Hi Jake,

    I'm soooo happy to hear that you are not an IE guy :o))

    You're right... most of my customers are also using IE as the primary browser, but many of them really would like to switch to Linux for desktops. Most of them are already running Linux on servers. So why haven't they switched to Linux yet, you might ask?

    One simple answer... (IBM'ers please stay tuned)... is that they are running the Notes client. Because WINE are not supporting the latest Notes versions 100% and because VMware are too expensive to buy for each desktop they are simply waiting for either of two things to happen:

    1) The Notes client running on Linux (this might come true for version 8 using the Eclipse platform), or

    2) The browsers becomming richer in functionality so that we (the developers) can create truly rich browser based applications.

  4. Just yesterday a new security issue in IE became public, bypassing IE's zone based "security" model, using a redirect.

    Btw: Firefox 0.9 can access Domino Web Access 6.5.1 just perfectly, whereas Mozilla 1.6 simply crashes. For my personal taste, 0.9 is the most mature release since 0.5.

    • avatar
    • Andrew Tetlaw
    • Tue 15 Jun 2004 05:53 PM

    I'm an intranet developer in a company with IE6 as standard. BUT I develop a cross-browser capable intranet. Not out of any political reasons but simply because it makes sense to.

    Just because we have a bunch of staff sitting at work PCs with IE6 installed doesn't mean that that's how our intranet will be used forever.

    Keeping a "cross-browser" frame of mind enables you to build a flexible interface. So when we start encouraging people to use our intranet from home and some of them have Macs and want to use Safari there's no problems what so ever. When some staff want to use PDAs to access the intranet, no problems again!

    I just don't want to rely on one vendors technology base. I think it promotes inflexibility and, dare I say it, it might even shorten the life of our intranet!

  5. Can you tell me how to returned value

  6. this can't run in mozilla

  7. I find a free color picker for windows

    {Link}

  8. Sure, most people use Internet Explorer. But when you're building a web application (which is likely why you'd want to use a color picker), you need to think about the users using Firefox, Opera, Safari, or whatever. I mean, you're still going to have to code a solution that works for them, so you might as well use it in IE too.

    (Now how should I code a color picker for Opera...???)

  9. The problem is that if you are developing a web application you severly limit yourself if you try and build in cross-browser compatibility.

    There are so many great things that you can only do in IE5+ (such as behaviours, filters, the colour picker, scriptable editing, VML, HTML:TIME and many DHTML methods). In addition if you build for only one browser then you know that the CSS styles will always look the same.

    I would prefer to limit myself to 95% of billions of people than build bloated web apps with less functionality!

  10. ummm its interesting you mention that IE is pumping the stats due to forced usage....

    THis is the same problem that games ruinning on linux have.

    If everyone uses wine to run games on linux, then not only do the manufacturers have no incentive to develop for linux but it also gives the false impression to other consumers that windows is the pre-dominate system.

    And to bring reality into it.....the only reason why windows is the most widely used system is because its pre-installed at the shops....which is due to microsoft protection racket.

    to paraphrase Asiyu from ubuntforums....

    A system doesnt have to behave well nor look good to be the most popular software....it simply has to come pre-installed.

    and why is it that many still use petrol? pre-installed again....sigh.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Mon 14 Jun 2004

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content