1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Javascript help :)

Discussion in 'JavaScript' started by joesgraphics, Mar 11, 2007.

  1. #1
    Hey dont know if any one can help me but im trying to when you click a value on a dropdown list it shows a pic and a link it 2 difretn divs i did have ago at making the script my self but dont thinkl i did it right i aint very good in javscript/ajax here is the code i made:-


    function editlink(1) 
    { 
    
        var frm = document.editlinks; 
    
        
    	var headertopimage = '<img src="images/headertoplink.gif" title="" alt="" />';
    	var headertoptext = 'Click <a onclick="">here to edit these links.';
    	
    	var headerbottomimage = '<img src="images/headertoplink.gif" title="" alt="">';
    	var headerbottomtext = 'Click <a onclick="">here</a> to edit these links.';
    	
    	var headertopimage = '<img src="images/headertoplink.gif" title="" alt="">';
    	var headertoptext = 'Click <a onclick="">here to edit these links.';
    	
    	
    	
    if (1) { document.getElementById('exampleimage').innerHTML= headertopimage ; }
    else {}
    if (1) { document.getElementById('examplelink').innerHTML= headertoptext ; }
    else {}
    	
    if (2) { document.getElementById('exampleimage').innerHTML= headerbottomimage ; }
    else {}
    if (2) { document.getElementById('examplelink').innerHTML= headerbottomtext ; }
    else {}
    }
    Code (markup):

    and the divs and dropt down box will be like:-


    
    <table border="0" cellpadding="3" cellspacing="0" width="80%" height="364">
     <tr>
       <td width="100%" height="359">
       <table border="0" cellpadding="3" cellspacing="0" width="100%" height="349">
         <tr>
           <td width="29%" height="343">
    
    <form class="editlinks" id="editlinks" action="">
      <select size="11" name="Select">
      <option value="Select" selected>Select</option>
      <option value="Header Top" onclick="editlink(1)">Header Top</option>
      <option value="Header Bottom" onclick="editlink(2)">Header Bottom</option>
           </select>
    </form>       
           </td>
           <td width="71%" height="343">
           <table border="0" cellpadding="0" cellspacing="0" width="100%" height="330">
             <tr>
               <td width="100%" height="298"><div id="exampleimage">div image</div></td>
             </tr>
             <tr>
               <td width="100%" height="32"><div id="examplelink">div text</div></td>
             </tr>
           </table>
           </td>
         </tr>
       </table>
       </td>
     </tr>
    </table>
    HTML:
    If any one can help would be great or is there a script out there like this.

    Thanks in advanced.
     
    joesgraphics, Mar 11, 2007 IP