Page 1 of 1

Javascript hacker challenge

Posted: Sat Sep 09, 2006 2:40 am
by alex.barylski
Edit: To be fare...and prevent people from using your ideas...PM the result code and I will test each entry on Windows XP (IE6, FF1.5, NS8.1, OP9.01)

I will bump this thread in a day or two with the results and associated code for all to see and learn from...and results of my tests. Anyone capable of testing on Linux or a Mac would be awesome if you PM'ed me and offered your judging.

For the sake of brevity...cause I know your all just shooting to go...maybe a limit of the first 15-25 entries will be accepted...one per candidate...I'm already in so make that 24 ;)

===================================================

So here is the proposal:

Code: Select all

<html>
  <script src="test.js"></script>
  <script>
    changeDOM("test1", "Bold section changed dynamically");
    changeDOM("test2", "Anchor changed dynamically");
  </script>
  <body>
    <b id="test1">Some static text - to be changed dynamically</b>
    <a href="" id="test2">Some static hyperlink - to be changed dynamically</2>
  </body>
</html>

Code: Select all

// test.js

function changeDOM(content)
{
  // Manipulate the DOM (something easy like innerHtml, etc)
}
Rules:
Using the *most* cross browser approach possible and as elegantly as possible, calling changeDOM() as inlined Javascript like shown above allow changeDOM to access to the DOM...

Points should be considered lost for each browser not supported...perhaps we can have series of people test on various browser(s) Apple, Linux and Windows and the one which is MOST cross browser wins...

Hints:
1) The DOM is *not* ready or available when inline script executes...and it MUST execute inline.

2) defer="defer" in script tags is not that cross-browser friendly :P

Ladies and gentlemen here we have a challenge which will can actually be quantified (using test browsers and results) so the winner is clear and obvious...no cheating or favourites...

I present to you (drum roll) The Unnofficial PHP Developers Network First Annual Coding Contest (Award?) :P

Ready.Set.Go!!! :)

Cheers :)

Posted: Sat Sep 09, 2006 8:15 am
by feyd
Leave our name out of this in its entirety.

Posted: Sat Sep 09, 2006 10:39 am
by nickvd
Um...
1) The DOM is *not* ready or available when inline script executes...and it MUST execute inline.
How do I mess about with the DOM, if it's not ready to be manipulated...

/me crys impossible...

Posted: Sat Sep 09, 2006 12:41 pm
by alex.barylski
feyd wrote:Leave our name out of this in its entirety.
Ouch...it was meant as more of a joke than anything...

But just out of curiousity...how does a contest become formal? Does it need the approval of the community?

I can't say I'm pleased with your tone or lack of any kind of expression, other than "I am tiger hear me roar" style of letting me know whose boss.

Do me a favour...next time...just drop the thread completely, I'll get the hint... ;)

Posted: Sat Sep 09, 2006 12:45 pm
by alex.barylski
nickvd wrote:Um...
1) The DOM is *not* ready or available when inline script executes...and it MUST execute inline.
How do I mess about with the DOM, if it's not ready to be manipulated...

/me crys impossible...
I assure your it's not impossible... ;)

No one seems very interested in participating...so if your curious, email me and i'll show how I did it ;)

nuweb1@hotmail.com

Posted: Sat Sep 09, 2006 1:47 pm
by Weirdan
But just out of curiousity...how does a contest become formal? Does it need the approval of the community?
Official contests are either run by or approved by the board of moderators. If there's a wide interest for particular contest expressed by the community, it certainly will be approved. Your proposal does not seem to be the case though.

Posted: Sat Sep 09, 2006 2:03 pm
by alex.barylski
^^^ Clearly :P

I wonder why... *scratches chin*

There is, as a result of solving this problemm quite a handy feature which becomes available, not otherwise supported by javascript.

Meh...whatever...no biggie :)

Cheers