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 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)

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

Vue 3 Vue 3 Apr 02, 2025 pm 06:32 PM

It&#039;s out! Congrats to the Vue team for getting it done, I know it was a massive effort and a long time coming. All new docs, as well.

Can you get valid CSS property values from the browser? Can you get valid CSS property values from the browser? Apr 02, 2025 pm 06:17 PM

I had someone write in with this very legit question. Lea just blogged about how you can get valid CSS properties themselves from the browser. That&#039;s like this.

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:

Comparing Browsers for Responsive Design Comparing Browsers for Responsive Design Apr 02, 2025 pm 06:25 PM

There are a number of these desktop apps where the goal is showing your site at different dimensions all at the same time. So you can, for example, be writing

Using Markdown and Localization in the WordPress Block Editor Using Markdown and Localization in the WordPress Block Editor Apr 02, 2025 am 04:27 AM

If we need to show documentation to the user directly in the WordPress editor, what is the best way to do it?

Stacked Cards with Sticky Positioning and a Dash of Sass Stacked Cards with Sticky Positioning and a Dash of Sass Apr 03, 2025 am 10:30 AM

The other day, I spotted this particularly lovely bit from Corey Ginnivan’s website where a collection of cards stack on top of one another as you scroll.

See all articles