| Cora's profileJIA的共享空间PhotosBlogLists | Help |
|
5/27/2009 Always find out which kind of value I haven’t got enoughAs 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)
TrackbacksThe trackback URL for this entry is: http://coracoracora1984.spaces.live.com/blog/cns!9BB265356F70692F!200.trak Weblogs that reference this entry
|
|
|