﻿
//创建form
function CreateForm(actionUrl, target) {
    var tempForm = document.createElement("form");
    tempForm.id = "tempForm1";
    tempForm.method = "post";
    tempForm.action = actionUrl;
    tempForm.target = target;
    return tempForm;
}
//加入隐藏域
function AddInput(tempForm, name, value) {
    //构建订单号隐藏域
    var hideInput = document.createElement("input");
    hideInput.type = "hidden";
    hideInput.name = name;
    hideInput.value = value;
    tempForm.appendChild(hideInput);
}
//提交表单
function SubmitForm(tempForm) {
    //onsubmit添加执行的事件
    tempForm.attachEvent("onsubmit", function() { });
    //构建form加入到页面中
    document.body.appendChild(tempForm);
    //添加onsubmit事件
    tempForm.fireEvent("onsubmit");
    tempForm.submit(); //提交
    //移除form
    document.body.removeChild(tempForm);
}






//得到点击的位置

function GetClickLocation(ATarget)
{
    //获得对象相对于版面的上和左的距离
    var target = ATarget;
    var x = target.offsetLeft;
    var y = target.offsetTop;

    //取得偏移量
    target = target.offsetParent;

    // 取得绝对位置
    while (target)
    {
        x += target.offsetLeft;
        y += target.offsetTop;
        target = target.offsetParent;
    }

    //声明一个坐标数组
    var coordinate = new Array();

    coordinate[0] = x;
    coordinate[1] = y;
    return coordinate;
}

