It is important for us to write a VML that, if combined with a database, read the data and convert the data into VML into two parts. If you directly use ASP to generate a page containing many VML, once the amount of data, the whole page becomes very large, the download speed is slow, ie is slow to interpret the code, so it is very important to dynamically generate VML with a script.
Using VML to draw one, you can more clearly the meaning of the above:
In front of the text is simply said: Use an Iframe to do the background, the foreground is generated by script. Perhaps worry, the backstage has been completed, but the front desk has not initialized the situation, you can rest assured, because the process of reading data must be relatively slow, if you worry about the amount of data, as long as you put
The script is placed in front of the body and the Iframe is placed on the last side of the body, there is no problem with synchronization errors.
Now let's talk about how to dynamically generate VML using scripts. In fact, this is the same process as using scripting to generate HTML dynamically.
Dynamically creating VML
Corresponding in the readdata.asp:
The color above is HomeSite 4.5.2 style
After reading the above, do you have some understanding of this mode? The following is a discussion of the dynamic generation of VML to pay attention to some of the problems, first of all, the document CreateElement method. Different versions of IE, the use of createelement also differ, in earlier versions of IE, createelement can only create Select OPTION, such as Var newoption=document.createelement (" OPTION "); But after IE5.0, createelement can create all the objects, using the Var newelement=document.createelement (""); Note that the argument here must be a finished HTML tag, not a DIV, the advantage of this method is that you can use a statement to describe the newly created object clearly. The InsertBefore method works well, inserting the newly created object into the final.
We started with Group1, and all the dynamically generated VML is inserted directly behind the Group1. There have been three experiments, the first is ordinary, the use of ASP to generate VML code, the second is not an IFRAME, the same page generated script; The third is the example above, using an IFRAME to generate a script. Results under the condition of large data volume, the most efficient is the third one, followed by the second one, the first with a noticeable slow feeling.
The next section will talk about the most exciting features of VML and zoom out!