一聚教程网:一个值得你收藏的教程网站

热门教程

VML绘图板②脚本--VMLgraph.js、XMLtool.js

时间:2022-07-02 10:14:40 编辑:袖梨 来源:一聚教程网

脚本
*************
* VMLgraph.js
*************
var xo=0;
var yo=0;
var ox=80;
var oy=20;
var dx=0;
var dy=0;
var drawKey = false;
var itemID = 0;
var ShapeItemNum = 0;
var ShapeItemX = 0;
var ShapeItemY = 0;
var CurveItemNum = 0;
var NodeDelete = false;
var ToolBarNum = 2; // 预置的工具编号
var gradientX = -1;
function cursor(k) {
    xo = event.clientX - ox;
    yo = event.clientY - oy;
    if(k && xo>=0 && yo>=0)
    oxy.innerHTML = xo+","+yo;
    else
    oxy.innerHTML = "";
    if(drawKey) {
    paint();
    view.innerHTML = tree(canvas.documentElement,0);
    }
}
function setOverColor(v) {
    if(! NodeDelete) return;
    v.myColor = v.strokecolor;
    if(v.strokecolor == "red")
    v.strokecolor='#000000';
    else
    v.strokecolor='#ff0000';
}
function setOutColor(v) {
    if(! NodeDelete) return;
    v.strokecolor = v.myColor;
    view.innerHTML = tree(canvas.documentElement,0);
}
function deleteNode(v) {
    if(! NodeDelete) return;
    var id = v.id;
    for(i=0;i    var node = canvas.selectNodes("/*//*")[i];
    if(node.getAttribute("id") == id) {
        canvas.documentElement.childNodes[0].removeChild(node);

热门栏目