PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Sep 28, 2020 2:18 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 40 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: Tue Jul 11, 2006 4:26 pm 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6446
Location: 53.01N x 112.48W

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 11, 2006 4:30 pm 
Offline
Breakbeat Nuttzer
User avatar

Joined: Wed Mar 24, 2004 8:57 am
Posts: 13098
Location: Melbourne, Australia


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 11, 2006 4:52 pm 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6446
Location: 53.01N x 112.48W

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 11, 2006 4:57 pm 
Offline
Breakbeat Nuttzer
User avatar

Joined: Wed Mar 24, 2004 8:57 am
Posts: 13098
Location: Melbourne, Australia


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 11, 2006 5:29 pm 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6446
Location: 53.01N x 112.48W

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 1:43 am 
Offline
Moderator
User avatar

Joined: Mon Nov 03, 2003 7:13 pm
Posts: 5978
Location: Odessa, Ukraine
switching to standards mode from quirks might improve speed as well... try it :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 1:48 am 
Offline
Moderator
User avatar

Joined: Mon Nov 03, 2003 7:13 pm
Posts: 5978
Location: Odessa, Ukraine
Javascript part could be improved as well: you can attach event listeners to wrapper div instead of every color cell.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 9:50 am 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6446
Location: 53.01N x 112.48W

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 10:02 am 
Offline
Moderator
User avatar

Joined: Mon Nov 03, 2003 7:13 pm
Posts: 5978
Location: Odessa, Ukraine


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 10:06 am 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6446
Location: 53.01N x 112.48W
Interesting

... goes to fiddle

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 11:12 am 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6446
Location: 53.01N x 112.48W
Well, to my complete lack of surprise, I've got it working nicely in Firefox, but IE once again craps all over my hopes and dreams.

Turns out IE doesn't support event.target, but rather event.fromElement. Not a big deal. However, if you go to the again in IE, you'll notice nothing happens when you click on a colour. That's because event.fromElement is returning null.

The div with all the events attached looks like:
Syntax: [ Download ] [ Hide ]
<div style = "font-size:5pt;" onmouseover = 'showColour(event);' onclick = 'setColour(event);'>


The javascript functions it calls are:
Syntax: [ Download ] [ Hide ]
      function showColour(event)

      {

        target = (event.fromElement) ? event.fromElement : event.target;

        if(target)

        {

          colour = target.style.backgroundColor;

          document.getElementById('well').style.backgroundColor = target.style.backgroundColor;

        }

      }



      function setColour(event)

      {

        target = (event.fromElement) ? event.fromElement : event.target;



        if(target)//this condition is never satisfied in IE

        {

          colour = target.style.backgroundColor;

          properColour = convertToHex(target.style.backgroundColor);

          window.opener.document.$this->element_id.value = properColour;

          window.close();

        }

      }

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 12:31 pm 
Offline
Spockulator
User avatar

Joined: Wed Feb 04, 2004 9:15 pm
Posts: 4714
Location: Eden, Utah


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 12:33 pm 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6446
Location: 53.01N x 112.48W
It shows: [object]

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 12:42 pm 
Offline
Spockulator
User avatar

Joined: Wed Feb 04, 2004 9:15 pm
Posts: 4714
Location: Eden, Utah


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 12:46 pm 
Offline
Breakbeat Nuttzer
User avatar

Joined: Wed Mar 24, 2004 8:57 am
Posts: 13098
Location: Melbourne, Australia


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 40 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group