window.addEvent('load', function(){ $$('.admin').each( function( item, index ){ var type = item.getProperty( 'type' ); //console.log( type ); var html = ''; if( type == 'code' ){ html = edit_code( item ); } if( type == 'product' ){ html = edit_product( item ); } var pos = item.getCoordinates(); var view = new Element( 'div', { 'styles': { 'position' : 'absolute', 'border' : '1px solid #FFCC99', 'background': '#FFCCFF', 'padding' : '5px', 'left' : pos.left + pos.width + 'px', 'top' : pos.top + 'px' }, 'html' : html, 'events': { 'mouseenter': function(){ item.setStyle( 'background', '#FFFFCC' ); }, 'mouseleave': function(){ item.setStyle( 'background', '' ); } } }); view.inject( document.body ); }); }); var win = {}; function show_win( url ){ win = new Nuit_modle_window ( { 'mask_classname' : 'mask_div', 'center_div_classname' : 'center_div', 'height' : 500, 'width' : 520 } ); win.create_complete = function(){ var req = new Request.HTML( {'url': url, 'evalScripts':true, 'update':win.center_div }).get(); req.addEvent( 'complete', function(){ var childrens = win.center_div.getChildren(); win.center_div_resize(); }); } win.mask_div.addEvent( 'click', function(e){ //console.log( win.center_div.clicked ); if( win.center_div.clicked == '0' ){ win.hidden(); win.center_div.clicked = '1' }else{ } }); } function edit_code( item ){ var did = item.getProperty( 'did' ); var html = '修改'; return html; } function edit_product( item ){ var did = item.getProperty( 'did' ); var html = '修改'; return html; } function add_value( id, value ){ $(id).value = value; }