Hotlinlinking to build backlinks, help to make this script work

Discussion in 'JavaScript' started by sv800, Aug 4, 2007.

  1. #1
    I'm trying to install the script listed here:

    "How to use hotlinkers and Google Images to build natural links to your site"

    The objective is to open a window and display "the code to copy", when hotlinkers right click on a image. This way it is possible to get some back links.

    I created a serialized <div> id section: imagelayer0, imagelayer1, imagelayer2:
    <div id="imagelayer0" for image 1

    <div id="imagelayer1" for image 2

    The code below is for image # 1, note that I did not post the code for image 2, 3, 4...

    Problem: Does no matter which image is right clicked, script always opens the last image <div> code ...

    I'm not experienced with js, and the right click, but looks the right click is related to the last image...

    I appreciate any suggestion....


    Here is the code



    
    <script type="text/javascript" language="JavaScript"><!--
    
    function RemoveContent0(d) {
    
    document.getElementById(d).style.display = "none";
    
    }
    
    function InsertContent0(d) {
    
    document.getElementById(d).style.display = "";
    
    }
    
    
    function clickIE40(){
    if (event.button==2){
    InsertContent0('imagelayer0');
    return false;
    }
    }
    
    function clickNS40(e){
    if (document.layers||document.getElementById&&!document.all){
    if (e.which==2||e.which==3){
    InsertContent0('imagelayer0');
    return false;
    }
    }
    }
    
    if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=clickNS40;
    }
    else if (document.all&&!document.getElementById){
    document.onmousedown=clickIE40;
    }
    
    document.oncontextmenu=new Function("InsertContent0('imagelayer0');return false")
    
    // --> 
    
    </script>
    
    
    
    <div id="imagelayer0" style="width:500px;margin-top:10px; border: 1px solid red; display: none;"><a href="javascript:RemoveContent0('imagelayer0')"><img src="http://blg.ataqui.com/images/close.gif" alt="Close" title="Cerrar" align="right" valign="top" border="0"></a>
    <div class="bigtxt" style="padding:10px;" align="center" valign="top" width="500"><p align="left"><b>Pega esta imagen en tú pagina, Foro, Myspace o Ebay con este código...</b></p>
    <textarea rows="4" cols="50"><a href="http://www.plecnc.com/blog/2007/08/02/el-peor-y-el-mejor-trabajo-del-mundo/"><img src="http://www.plecnc.com/blog/wp-content/uploads/2007/08/un_trabajo_feo.jpg" border="0" alt="El trabajo en el campo"></a></textarea>
    
    </div>
    </div>
    
    
    Code (markup):
     
    sv800, Aug 4, 2007 IP