csdn产品小助手 2010-01-17 01:53 采纳率: 0%
浏览 24

反馈表不显示

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';
        }
    }
}
  • 写回答

1条回答 默认 最新

  • weixin_33713503 2010-01-17 01:59
    关注

    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) { ...
    
    评论

报告相同问题?

悬赏问题

  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
  • ¥15 画两个图 python或R
  • ¥15 在线请求openmv与pixhawk 实现实时目标跟踪的具体通讯方法
  • ¥15 八路抢答器设计出现故障
  • ¥15 opencv 无法读取视频