2016-12-12 3 views
0

私のページの一部を再作成する必要があります。 これは私のリンクを作っているコードの一部です:画面でinnerHTML情報

$downloadLinks .= '<li><a onclick="document.getElementById(\'last-crop-resize\').parentElement.style.backgroundColor=\'lightgreen\';document.getElementById(\'last-crop-resize\').innerHTML=this.href" target="_blank" href="'._CONFIG_SITE_PROTOCOL . '://' . file::getFileDomainAndPath($file->id, $file->serverId, true) . '/' . PLUGIN_DIRECTORY_NAME.'/images/scripts/resize_image.php?m=middle&f='.(int) $file->id.'&w='.$linkWidth.'&h='.$linkHeight.'"><i class="entypo-right"></i>JPG '.$linkWidth.' x '.$linkHeight.' px</a> </li>'; 

私はこのようないくつかのことを取得しています:私はdouingい

https://localhost/plugin/images/scripts/resize_image.phpm=middle&f=16788&w=390&h=276 

すべてはクリックでそれを選択しています。

今、私は私の画面出力がこれですように、この部分を変更する必要があります:私はできるだけ早く私は<img私の出力を配置しようとしてinnerHTMLの内側に脱出のためにASCIIを使用してみましたが、き

{*<img src="https://localhost/plugin/images/scripts/resize_image.php 
    m=middle&f=16788&w=390&h=276" 
    alt="" title="" width="390" height="276" vspace="20" hspace="20" border="0" 
    style="width:390px;height:276px;margin-top:0px;margin-bottom:0px; 
    margin-left:0px;margin-right:0px;border:0px solid black;" class="" />*} 

スタートの崩壊。

  1. それがリダイレクトされていません。

    だから、もう少し情報を追加します。

  2. 私が必要とするすべての機能は、クリックするとすべてを選択するので、出力をコピーできます。

これは可能ですか?

+0

あなたは正確に何をしようとしていますか?写真をリンクにする? –

+0

クリックすると誰かが別のページでコピーして使用できる大きな「リンク」である必要があります。そこに座っているだけではリダイレクトされません。クリックしてコピーする – user3350597

+0

クリックしてすべてを選択しますか? jqueryを使用していますか?タグが付いていませんか?ユーザーがクリックすると – happymacarts

答えて

0

aタグに巣にimg要素を許可されている

。私の質問のタイトルは悪かったので、私はそれを変更しました。 私がする必要があったのは innerHtmlで、 hrefではなく変更することでした。私が何を考えているのか分からない。

$downloadLinks .= '<li><a onclick="document.getElementById(\'last-crop-resize\').parentElement.style.backgroundColor=\'lightgreen\';document.getElementById(\'last-crop-resize\').innerHTML=\'{*<&#127;img src=&quot;\'+this.href+\'&quot; alt=&quot;&quot; title=&quot;&quot; width=&quot;'.$linkWidth.'&quot; height=&quot;'.$linkHeight.'&quot; vspace=&quot;20&quot; hspace=&quot;20&quot; border=&quot;0&quot; style=&quot;width:'.$linkWidth.';height:'.$linkHeight.';margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;border:0px solid black;&quot; class=&quot;&quot; &#47;>*}\'"; target="_blank" href="'._CONFIG_SITE_PROTOCOL . '://' . file::getFileDomainAndPath($file->id, $file->serverId, true) . '/' . PLUGIN_DIRECTORY_NAME.'/images/scripts/resize_image.php?m=middle&f='.(int) $file->id.'&w='.$linkWidth.'&h='.$linkHeight.'"><i class="entypo-right"></i>JPG '.$linkWidth.' x '.$linkHeight.' px </a> </li>'; 

出力は次のとおりです:助けようとしたすべての人に

{*<img src="https://localhost/plugin/images/scripts/resize_image.php 
m=middle&f=16788&w=390&h=276" 
alt="" title="" width="390" height="276" vspace="20" hspace="20" border="0" 
style="width:390px;height:276px;margin-top:0px;margin-bottom:0px; 
margin-left:0px;margin-right:0px;border:0px solid black;" class="" />*} 

おかげ これが私の解決策です。

0

あなたが達成しようとしていることは不明ですが、画像をリンクとして使用しようとしていると思いますか?

ので、ここでの場合は、何が必要です:

<a href="https://localhost/plugin/images/scripts/resize_image.php 
     m=middle&f=16788&w=390&h=276"> 
    <img src="https://localhost/plugin/images/scripts/resize_image.php 
    m=middle&f=16788&w=390&h=276" 
    alt="" title="" width="390" height="276" vspace="20" hspace="20" border="0" 
    style="width:390px;height:276px;margin-top:0px;margin-bottom:0px; 
    margin-left:0px;margin-right:0px;border:0px solid black;" class="" /> 
</a> 

が、これは私はわかりませんが、私は、これはあなたが探しているものだと思います

0

を助けなら、私に教えてください。あなたは、私はそれが仕事を得ることに成功し

<a href="https://localhost/plugin/images/scripts/resize_image.php?m=middle&f=16788&w=390&h=276"> <img src="https://localhost/plugin/images/scripts/resize_image.php?m=middle&f=16788&w=390&h=276" 
 
    alt="" title="" width="390" height="276" vspace="20" hspace="20" border="0" 
 
    style="width:390px;height:276px;margin-top:0px;margin-bottom:0px; 
 
    margin-left:0px;margin-right:0px;border:0px solid black;" class="" /></a>

+0

@BviLLe_Kidのように見えますあなたは同じ反応に私を打ち負かす。 – happymacarts