簡體   English   中英

PHP文件中沒有href的回顯鏈接添加目標為空白

[英]php echo link without a href in file add target blank

<?php echo auto_link(site_url('guest/view/quote/' . $quote->quote_url_key)); ?>

例如,這將創建以下鏈接:

http://domainname.com/guest/view/quote/d163df9c4d426b3ab5ef6247bc380745

我如何向此php代碼添加target="_blank" 還是有另一種方法可以達到相同目的。

編輯1:從php頁面添加了所有腳本。

<script type="text/javascript">

$(function() {

    $('#btn_add_item_from_lookup').click(function() {
        $('#modal-placeholder').load("<?php echo site_url('item_lookups/ajax/modal_item_lookups'); ?>/" + Math.floor(Math.random()*1000));
    });

    $('#btn_add_item').click(function() {
        $('#new_item').clone().appendTo('#item_table').removeAttr('id').addClass('item').show();
    });

    <?php if (!$items) { ?>
        $('#new_item').clone().appendTo('#item_table').removeAttr('id').addClass('item').show();
    <?php } ?>

    $('#btn_save_quote').click(function() {
        var items = [];
        var item_order = 1;
        $('table tr.item').each(function() {
            var row = {};
            $(this).find('input,select,textarea').each(function() {
                if ($(this).is(':checkbox')) {
                    row[$(this).attr('name')] = $(this).is(':checked');                        
                } else {
                    row[$(this).attr('name')] = $(this).val();
                }
            });
            row['item_order'] = item_order;
            item_order++;
            items.push(row);
        });
        $.post("<?php echo site_url('quotes/ajax/save'); ?>", {
            quote_id: <?php echo $quote_id; ?>,
            quote_number: $('#quote_number').val(),
            quote_date_created: $('#quote_date_created').val(),
            quote_date_expires: $('#quote_date_expires').val(),
            quote_status_id: $('#quote_status_id').val(),
            items: JSON.stringify(items),
            custom: $('input[name^=custom]').serializeArray()
        },
        function(data) {
            var response = JSON.parse(data);
            if (response.success == '1') {
                window.location = "<?php echo site_url('quotes/view'); ?>/" + <?php echo $quote_id; ?>;
            }
            else {
                $('.control-group').removeClass('error');
                for (var key in response.validation_errors) {
                    $('#' + key).parent().parent().addClass('error');
                }
            }
        });
    });

    $('#btn_generate_pdf').click(function() {
        window.location = '<?php echo site_url('quotes/generate_pdf/' . $quote_id); ?>';
    });

    var fixHelper = function(e, tr) {
        var $originals = tr.children();
        var $helper = tr.clone();
        $helper.children().each(function(index) {
            $(this).width($originals.eq(index).width())
        });
        return $helper;
    };

    $("#item_table tbody").sortable({
        helper: fixHelper
    });

});

</script>

我已經解決了。 不是通過使用任何代碼,而是通過簡單地向用戶說明使用Ctrl +單擊。 這可能不是最好的事情。 應該有一種方法可以通過代碼實現相同的目的。 但是,在與Royal Bg進行了長時間的討論之后,我認為停止在火上放油是明智的。

我希望將來其他人可以提出最初的問題並發布解決方案,以使其他人從中受益。 同時,我將接受這個答案。 我希望其他人也這樣做。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM