Feedback form not displaying

I am trying to build a ajax feedback form but I am having problems getting it to display. The feedback image displays but when I click it nothing happens.

My Form:

  <div id="feedback"> 
    <img id="feedback_link" src="images/feedback.gif" href="javascript:open('feedback_form_wrapper');" /> 

      <div id="feedback_form_wrapper" style="display:none;"> 
    <a class="close light" style="float:right;margin-right:5px;" href="javascript:open('feedback_form_wrapper');" >CLOSE</a> 
    <form id="feedback_form" action="." onsubmit="submit(); return false;"> 
      <div style="margin: 8px; width: 184px; float: left;"> 
        <select name="subject"> 
          <option value="bug">Found A Bug</option> 
          <option value="typo">Found A Typo</option> 
          <option value="other">Other</option> 
        </select> 
       Email:<br/> 
       <input type="text" class="email"  name="email" /><br/> 
      <textarea name="body" id="feedback_body" style="height: 180px; margin-top: 8px;">Enter Feedback Here.</textarea> 
    <input type="submit" class="input_submit_button" value="submit" /> 
      </div> 
    </form> 
      </div> 

  </div>

The JavaScript:

function open(id){
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(id).style.display = 'block';
    }
    else {
        if (document.layers) { // Netscape 4
            document.id.display = 'block';
        }
        else { // IE 4
            document.all.id.style.display = 'block';
        }
    }
}

function close(id){
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(id).style.display = 'none';
    }
    else {
        if (document.layers) { // Netscape 4
            document.id.display = 'none';
        }
        else { // IE 4
            document.all.id.style.display = 'none';
        }
    }
}

Answers


I just tried your code and found the problem, you have an img tag with a href

the href attribute is for an anchor, not an img

to make this work on an image change href to onclick

also, change the name of the open() function to something else, open is already a function in javascript.

ie.

<img id="feedback_link" src="images/feedback.gif" onclick="show('feedback_form_wrapper');" /> 

function show(id) { ...

Need Your Help

Running Eclipse on desktop = can't find companion library

eclipse

I just downloaded Eclipse Juno onto my machine. I extracted the files to an Eclipse subdirectory in "C:\Program Files". When I try to launch eclipse from here, it works great! But I don't want to h...

mySQL - Count Distinct Over Multiple Columns, as One

mysql count distinct-values

I have a mySQL DB in which two columns may refer to the same Identifier. One column is PartyA and the other is PartyB (as in counter-parties to an exchange, or nodes in a graph).