Thursday, 6 March 2008

document.write flush your page or can not append new contents

Html actually is multithread.

Let's talk about onclick and setTimeout in html code and javascript.

The function invoked by onclick of form button and setTimeout of javascript all start a new thread to do jobs. If you run command "document.write(SOMETHING)" in the function invoked by above two ways, the SOMETHING will flush your current page, then use SOMETHING to rewrite the page. Namely, this "document" are not the original "document".

More details are on:
http://www.howtocreate.co.uk/tutorials/javascript/writing




No comments:

My photo
London, United Kingdom
twitter.com/zhengxin

Facebook & Twitter