Javascript vbscript challenge

Whilst hacking away in javascript I was experimenting with various things and I thought of a problem which would make a good challenge.

The idea was to produce some vbscript which executed the msgbox function without using parenthesis but the trick was not to raise a syntax error in javascript when parsing the code. I found a cool solution to this but lets see what you can come up with. Here are the main rules:-

Rules

1. No parenthesis may be used.
2. The vbscript version must execute msgbox with a argument of 1.
3. No syntax errors in either vbscript or jscript.
4. Errors can’t be turned off, using window.onerror for example is not allowed.
5. Both code samples must work in IE7.
6. The javascript and vbscript code should be identical.

In order to win the challenge you must provide the correct code which executes within the following tags:-




9 Responses to “Javascript vbscript challenge”

  1. Giorgio Maone writes:


    MsgBox 1′

  2. Giorgio Maone writes:

    Any way to preserve formatting and JS comments? Let’s try this way…
    <pre>

    MsgBox 1′
    </pre>

  3. Giorgio Maone writes:

    OK,
    unescape(
    “%27%27%0AMsgBox%201%27”
    )

  4. Gareth Heyes writes:

    Sorry Giorgio my bad commenting in my blog, nice one! It was a sub challenge hehe 🙂

  5. Gareth Heyes writes:

    Hmmmm tried it in IE7 and it causes syntax errors. Close but not correct.

    You can submit entries here:-
    http://sla.ckers.org/forum/read.php?2,25291

  6. Giorgio Maone writes:

    Gareth, did you decode it correctly?
    Here’s the code above live, tested in IE8 both in standard and compatibility mode:
    http://evil.hackademix.net/test/vbjs.html

  7. Giorgio Maone writes:

    OK, I tried to unescape my code above: your *ckying SpamBam elided the JS c-style comments once more, even if they were url-escaped 😡

  8. Gareth Heyes writes:

    Ah-ha sorry again, that is a correct answer 🙂

  9. Giorgio Maone writes:

    Will this one pass through SpamBam?
    ‘\
    MsgBox 1’