Home Web Front-end CSS Tutorial 脚本动态生成VML_VML相关

脚本动态生成VML_VML相关

May 16, 2016 pm 12:09 PM

我们编写 VML 很重要的就是要和 数据库结合,如果和数据库结合了,读数据和把数据转换成 VML 变成了两部分。如果直接使用 ASP 生成 包含很多 VML 的页面,一旦数据量多了,整个页面就变得很庞大,下载速度慢了,IE解释代码的速度也慢了,所以用脚本动态生成 VML 变得非常重要了。

    用 VML 画一个示意图,可以更明确上面的意义:


    前面的图文简单的说就是:使用一个 Iframe 做后台,前台用脚本生成。也许担心,后台已经完成了,但前台还没有初始化的情况,你可以放心,因为读数据的过程肯定相对要慢,如果担心数据量少,只要你把脚本放在 Body 前面,Iframe 放在 Body 的最后面,就不会产生同步错误的问题了。
    现在来具体讲讲如何用脚本动态产生 VML 。其实这和用脚本动态产生 HTML 是一样的过程。



  动态创建VML









相应的在 readData.asp 里面:

<script></script>

'数据库连接部分
'读数据部分
Do Until rs.EOF
%>

  parent.createPoint(x%>,y%>,value%>);

Loop
'数据库关闭部分
%>



上面的颜色采用 HomeSite 4.5.2风格

    看完上面的,是否对这种模式有所理解呢?下面谈谈动态生成 VML 所要注意的一些问题,先说说 document 的 createElement 方法。IE版本不同, createElement 的使用也有所区别,在早期版本的IE, createElement 只能创建 Select 里面 OPTION ,比如说 var newOption=document.createElement("OPTION"); 但在 IE5.0 以后,createElement 可以创建所有的对象,使用的方式是 var newElement=document.createElement("
"); 注意到没有,这里的参数必须是个完成的 HTML 标记,而不是 DIV,用这个方法的好处就是,可以用一个语句把新创建的对象描述清楚。insertBefore 方法很好用,它把新创建的对象插入到 最后。
    我们一开始就有了 Group1 ,所有以后动态生成的 VML 直接插入到 Group1 的后面就可以了。曾经做了三个实验,第一个是普通的,用ASP生成 VML 代码;第二个是不用Iframe,在同一个页面生成脚本;第三个就是上面的例子,使用Iframe 产生脚本。结果在大数据量的条件下,效率最高的是第三个,其次是第二个,第一个有明显的慢的感觉。
    接下来的一节,将讲述VML最激动人心的功能,放大缩小!
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Making Your First Custom Svelte Transition Making Your First Custom Svelte Transition Mar 15, 2025 am 11:08 AM

The Svelte transition API provides a way to animate components when they enter or leave the document, including custom Svelte transitions.

Working With GraphQL Caching Working With GraphQL Caching Mar 19, 2025 am 09:36 AM

If you’ve recently started working with GraphQL, or reviewed its pros and cons, you’ve no doubt heard things like “GraphQL doesn’t support caching” or

Building an Ethereum app using Redwood.js and Fauna Building an Ethereum app using Redwood.js and Fauna Mar 28, 2025 am 09:18 AM

With the recent climb of Bitcoin’s price over 20k $USD, and to it recently breaking 30k, I thought it’s worth taking a deep dive back into creating Ethereum

Show, Don't Tell Show, Don't Tell Mar 16, 2025 am 11:49 AM

How much time do you spend designing the content presentation for your websites? When you write a new blog post or create a new page, are you thinking about

How do you use CSS to create text effects, such as text shadows and gradients? How do you use CSS to create text effects, such as text shadows and gradients? Mar 14, 2025 am 11:10 AM

The article discusses using CSS for text effects like shadows and gradients, optimizing them for performance, and enhancing user experience. It also lists resources for beginners.(159 characters)

Creating Your Own Bragdoc With Eleventy Creating Your Own Bragdoc With Eleventy Mar 18, 2025 am 11:23 AM

No matter what stage you’re at as a developer, the tasks we complete—whether big or small—make a huge impact in our personal and professional growth.

What the Heck Are npm Commands? What the Heck Are npm Commands? Mar 15, 2025 am 11:36 AM

npm commands run various tasks for you, either as a one-off or a continuously running process for things like starting a server or compiling code.

A bit on ci/cd A bit on ci/cd Apr 02, 2025 pm 06:21 PM

I&#039;d say "website" fits better than "mobile app" but I like this framing from Max Lynch:

See all articles