2012-07-22 136 views
0

我在选择选项的onchange事件中使用javascript函数时收到了此消息。

功能是

<script type="text/javasript" src="jquery.min.js"></script> 
<script type="text/javascript"> 
function desigchanged() 
{ 

    $.get('jqueryphp.php?desig=wr',update); 
} 
function update(res) 
{ 
    $('#inpt4').html(res); 
} 
</script> 


<select id="inpt3" name ="designatn" onChange="desigchanged();"> 
      <option value="pm" selected>project manager</option> 
      <option value="wr">worker</option> 
      </select><BR><BR> 
      <label><font id="fnm">Gender</font></label> 
      <label><font id="fnm3">Male</font></label> 
      <input name="gender" type="radio" id="inpt11" value="Male" /> 
      <label><font id="fnm4">Female</font></label> 
      <input name="gender" type="radio" id="inpt22" value="Female" /><BR><BR> 
      <label><font id="fnm">Works Under</font></label> 
      <select name="wrkundr" id="inpt4"> 
      </select> 

jQuery的文件被正确包括在内。 请别人帮我。

在此先感谢

+0

可能的重复http://stackoverflow.com/questions/2075337/uncaught-referenceerror-is-not-defined – footy 2012-07-22 09:05:03

回答

0

编辑:

但你也可能是facing this problem(绝对/相对路径)。

而且

也有javascript

原文笔误:

have you done this

You should put the references to the jquery scripts first.

或者

This?

Maybe you are calling the ready function before the JQuery Javascript is included?

+0

从他的片段中可以看出,他在顶部包含jQuery,而且他没有使用'ready'。 – pimvdb 2012-07-22 09:10:50

+0

@pimvdb你好,我只是想确保它的执行方式也一样。作为一些脂肪酶剪切/粘贴代码,并使其更清洁,使其看起来不错:P ... btw我也编辑了我的帖子 – footy 2012-07-22 09:17:13

2

我怀疑这是因为错字的:

type="text/javasript" 

注意失踪 “脚本”, “C”。如果type属性未被正确定义,浏览器将不会执行脚本标记。

+0

根据我的测试,这是所有的浏览器 - 如果类型被定义,但不正确,它赢得了'被执行。这很好,因为你可以将模板放在'text/html'或其他任何地方。这是我的测试http://jsfiddle.net/s5rnv/ – Esailija 2012-07-22 09:20:05

+0

@Esailija:谢谢;我通常完全忽略它。 – pimvdb 2012-07-22 09:21:00

相关问题