问题解决,来的接分!!<form name='form1' method='post' onsubmit='Save();'>
<input name='mydata' type='hidden'>
<input name='submit' type='submit' value='保存' class='button'>
</form><table id='mywin<?=$i?>' value='<?=$id?>'><input id='count' type='hidden' value='0'> /**
* 提交
* data format: id,left,top,width,height,zindex|
* 123,100,100,100,194,100|122,100,100,100,411,100|
*/
function Save()
{
for(i=count.value; i>=0; i--)
{
mywin = document.getElementById('mywin'+i); 
myid = mywin.value;
myleft = mywin.offsetLeft - mdiv.offsetLeft;
mytop = mywin.offsetTop - mdiv.offsetTop;
mywidth = mywin.offsetWidth;
myheight = mywin.offsetHeight;
myzindex = mywin.style.zIndex;
form1.mydata.value += myid + ',' + myleft + ',' + mytop + ',' + mywidth + ',' + myheight + ',' +myzindex + '|';
}
}

解决方案 »

  1.   

    有一个属性集合,
    http://msdn.microsoft.com/workshop/author/dhtml/reference/collections/attributes.asp?frame=true
       MSDN Home >  MSDN Library >  Web Development >  HTML and CSS >  HTML and DHTML Reference >  Collections  
    attributes Collection  Internet Development Index --------------------------------------------------------------------------------Retrieves a collection of attributes of the object.What's New for Microsoft Internet Explorer 6
    This collection now applies to the attribute object. Syntax[ oColl = ] object.attributes 
    [ oObject = ] object.attributes(iIndex) Possible ValuesoColl Zero-based array of attributes applied to the object. 
    oObject Reference to an individual item in the array of elements contained by the object. 
    iIndex Required. Integer that specifies the zero-based index of the item to be returned. Members TableThe following table lists the members exposed by the attributes object. Click a tab on the left to choose the type of member you want to view.  Attributes/Properties     
     
    Show: 
    Attributes/Properties 
    Methods 
     Property Description 
    length Sets or retrieves the number of objects in a collection. 
     
     
     Attributes/PropertiesMethodsMethod Description 
    getNamedItem   Retrieves an attribute specified with the name property using the attributes collection. 
    item Retrieves an attribute for an element from the attributes collection. 
    removeNamedItem   Removes an attribute specified with the name property from an element using the attributes collection. 
    setNamedItem   Adds an attribute to an element using an attributes collection. ResThe expando properties of an object are included in the attributes collection of the object as of Internet Explorer 6. To access the expando properties of an object in earlier versions of Internet Explorer, use the Microsoft JScript for...in construct.The attributes collection does not expose the style object. Use the cssText property of the object's style property to retrieve the persistent representation of the cascading styles associated with an object.Unlike other DHTML collections, such as all and children, the attributes collection is static. Modifications to the properties of an object are not automatically reflected by an existing reference to the attributes collection of that object.ExampleThis example shows how to iterate through the collection of attributes of the specified object, displaying the name and value of the attributes as well as the language of the attribute (HTML or script).Show Example<SCRIPT>
    function ShowAttribs(oElem)
    {
        txtAttribs.innerHTML = '';    // Retrieve the collection of attributes for the specified object.
        var oAttribs = oElem.attributes;    // Iterate through the collection.
        for (var i = 0; i < oAttribs.length; i++)
        {
            var oAttrib = oAttribs[i];        // Print the name and value of the attribute. 
            // Additionally print whether or not the attribute was specified
            // in HTML or script.
            txtAttribs.innerHTML += oAttrib.nodeName + '=' + 
                oAttrib.nodeValue + ' (' + oAttrib.specified + ')<BR>'; 
        }
    }
    </SCRIPT>
    Standards InformationThis collection is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 . Applies ToBASE 
    Platform Version 
    Win16: 5 
    Win32: 5 
    Unix: 5 
    Mac: 5 
    Windows CE: 5.5 
    Version data is listed when the mouse hovers over a link, or the link has focus. 
     A, ACRONYM, ADDRESS, APPLET, AREA, attribute, B, BASE, BASEFONT, BDO, BGSOUND, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, HEAD, hn, HR, HTML, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, KBD, LABEL, LEGEND, LI, LINK, LISTING, MAP, MARQUEE, MENU, nextID, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TT, U, UL, VAR, XMP 
    Move the mouse pointer over an element in the Applies To list to display availability information for the listed platforms. See AlsoAbout the W3C Document Object Model Manage Your Profile |Legal |Contact Us |MSDN Flash Newsletter
    &copy; 2005 Microsoft Corporation. All rights reserved. Terms of Use |Trades |Privacy Statement