Cora's profileJIA的共享空间PhotosBlogLists Tools Help

Blog


    5/27/2009

    Always find out which kind of value I haven’t got enough

    As I learnt the code of our wonderful site, it seems kind of familiar, but which is actually a perfect stranger.

    What I got to know during the last two days was the stuff about javascript and php that I have never got an idea before.

    # JavaScript eval() Function

    It is really a new and powerful  function I came across in JavaScript. To be honest, I never took long time to learn JavaScript, somehow, I’m a little bit scared with JavaScript, which is a really powerful, weird, and awesome language in today’s front-end development field.

    Anyway, let’s back to eval() function.

    As W3C defined, the eval() function evaluates a string and executes it as if it was script code. The parameter String is required.

    e.g.

    <script type=”text/javascript”>

    eval(“x=10; y=20; document.write(x*y)”);

    document.write(eval(“2+2”));

    var x=10;

    document.write(eval(x+17));

    </script>

    so the output of the above example should be as follow:

    200 4 27

    It can be a easy and simple way to operate strings without decode them first.

     

    # HTML DOM click() Method

    I guess this is a normal function that’s widely used in daily JavaScript development. Meanwhile, I didn’t get to know its functionality until yesterday unfortunately. :(

    So the click() method simulates a mouse-click on a button. Actually the functionality is easy to imagine.

    Such as

    buttonObj.click();

    Easy to understand, right?

    # PHP ob_start

    What’s that mean? The answer is turning on output buffering.

    While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer.

    The contents of this internal buffer may be copied into a string variable using ob_get_contents(). To output what is stored in the internal buffer, use ob_end_flush(). Alternatively, ob_end_clean() will silently discard the buffer contents.

    Output buffers are stackable, that is, you may call ob_start() while another ob_start() is active. Just make sure that you call ob_end_flush() the appropriate number of times. If multiple output callback functions are active, output is being filtered sequentially through each of them in nesting order.

     

    Always find out which kind of value I haven’t got enough.

     

    Little Fox

    Comments (1)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    鉴 马wrote:
    hi cora, now Adobe China R&D Center has an opening position - Web Producer in Web Team. I think you are a good candidate to apply this position. Do you have interests about it? If yes, please send your resume(CHN/ENG) to me. My email is zerlot@gmail.com. When I get your email, I will send the detail Job Description to you. :)
    June 12

    Trackbacks

    The trackback URL for this entry is:
    http://coracoracora1984.spaces.live.com/blog/cns!9BB265356F70692F!200.trak
    Weblogs that reference this entry
    • None