黄聪

论SEO对人类的重要性,请看我的博客:hcsem.com

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
<?php 
        wp_enqueue_script('media-upload');
        wp_enqueue_script('thickbox');
        wp_enqueue_script('my-upload');
        wp_enqueue_style('thickbox'); 
    ?>
    <input id="upload_image" type="text" value="" />
    <input id="upload_image_button" type="button" style="width:auto;height:20px;" value="上传图片" />
    <script>
    jQuery(document).ready(function() {
        jQuery('#upload_image_button').click(function() {
         formfield = jQuery('#upload_image').attr('name');
         // show Wordpress' uploader modal box
         tb_show('', '<?php echo admin_url(); ?>media-upload.php?type=image&amp;TB_iframe=true');
         return false;
        });
        window.send_to_editor = function(html) {
         // this will execute automatically when a image uploaded and then clicked to 'insert to post' button
         imgurl = jQuery('img',html).attr('src');
         // put uploaded image's url to #upload_image
         jQuery('#upload_image').val(imgurl);
         tb_remove();
        }
    });
    </script>
posted on 2012-08-09 11:42  黄聪  阅读(3148)  评论(0编辑  收藏  举报