日期选择器,在同一页面中显示上传的图像

时间:2014-05-10 16:27:19

标签: javascript php jquery

我不能使用js date piker&用于显示上传图像的js,它总是会导致冲突 并且只有用于显示上传图像的js有效。 有我的脚本代码:

<script src="js/bootstrap-datepicker.js"></script>  

<script>


if (top.location != location) {
    top.location.href = document.location.href ;
 }
    $(function(){
        window.prettyPrint && prettyPrint();

        $('#birth_date').datepicker({
            format: 'yyyy-mm-dd',
            viewMode: 'years',


            });                 

    });
</script>


<script type="text/javascript" src="scripts/jquery.min.js"></script>
<script type="text/javascript" src="scripts/jquery.form.js"></script>

<script type="text/javascript" >
 $(document).ready(function() { 

        $('#photoimg').live('change', function()            { 
                   $("#preview").html('');
            $("#preview").html('<img src="loader.gif" alt="Uploading...."/>');
        $("#imageform").ajaxForm({
                    target: '#preview'
    }).submit();

        });
    }); 
</script>

当我删除这个“(用于显示上传图像的js)”部分日期旅行者工作:

<script type="text/javascript" src="scripts/jquery.min.js"></script>
<script type="text/javascript" src="scripts/jquery.form.js"></script>

<script type="text/javascript" >
 $(document).ready(function() { 

        $('#photoimg').live('change', function()            { 
                   $("#preview").html('');
            $("#preview").html('<img src="loader.gif" alt="Uploading...."/>');
        $("#imageform").ajaxForm({
                    target: '#preview'
    }).submit();

        });
    }); 
</script>

并且有html代码:

<form method="POST" action="new_citz.php" enctype="multipart/form-data">
<div style="float:left">
<div id='preview'>
<img src='<?php echo $users_dir; ?>default.jpg'  class='preview'>
<input type="hidden" name="image" value="default.jpg">
</div>
</div>
<input type="hidden" name="type" value="<?php echo $type; ?>">
<span class='desc'>upload ur image here .</span>

<ul class="ipsForm ipsForm_vertical">
<li class="ipsField">
<label class="ipsField_title">birth_date<span class="ipsForm_required">*</span></label>
<div class="ipsField_content">
<input type="text" name="birth_date" id="birth_date">
<br>
<span class='desc'></span>
</div>
</li>
</ul>
</div>



<fieldset class="submit">
<center>
<input type="submit" value="save" name="submit" class="input_submit">
</center>
</fieldset>
</form>

0 个答案:

没有答案