Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/408.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将开关大小写值传递给html元素 在此处插入标题 你好 功能me(mes) { 交换机(mes){ “了解我们的数字”案例: var newElement=“”; $(“#p”).html(新元素); 警报(mes); 打破 案例“整数”: 警报(mes); 打破 } }_Javascript_Html - Fatal编程技术网

Javascript 将开关大小写值传递给html元素 在此处插入标题 你好 功能me(mes) { 交换机(mes){ “了解我们的数字”案例: var newElement=“”; $(“#p”).html(新元素); 警报(mes); 打破 案例“整数”: 警报(mes); 打破 } }

Javascript 将开关大小写值传递给html元素 在此处插入标题 你好 功能me(mes) { 交换机(mes){ “了解我们的数字”案例: var newElement=“”; $(“#p”).html(新元素); 警报(mes); 打破 案例“整数”: 警报(mes); 打破 } },javascript,html,Javascript,Html,在上面的代码中,我试图将switch case变量传递给html元素,但它不起作用。我需要根据脚本中的大小写选择播放视频。我的代码中有什么错误?请告诉我解决方法 提前感谢将此添加到头部 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html > <html> <head> &

在上面的代码中,我试图将switch case变量传递给html元素,但它不起作用。我需要根据脚本中的大小写选择播放视频。我的代码中有什么错误?请告诉我解决方法

提前感谢

将此添加到头部

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>

<body >


   <button onclick="me('${message}');">hello</button>
<div id="play">

</div>
<div id="p">

</div>

</body>
<script type="text/javascript">

   function me(mes)
   {

       switch(mes){
       case 'Knowing our Numbers':

           var newElement = "<object id='objViewer' width='250' height='250' type='video/x-ms-asf' data='Wildlife.wmv' classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'><param name='url' value='Wildlife.wmv'><param name='filename' VALUE='Wildlife.wmv'><PARAM name='autostart' VALUE='0'><param name='uiMode' value='full'><param name='autosize' value='1'><param name='playcount' value='1'><EMBED TYPE='application/x-mplayer2' src='Wildlife.wmv' NAME='MediaPlayer' id='wmvViewer' autostart='false' WIDTH='250' HEIGHT='250' ShowControls='1' ShowStatusBar='0' ShowDisplay='0'></EMBED></object><br/>";

        $("#p").html(newElement);
          alert(mes);     

       break;
       case 'Whole Numbers':
           alert(mes);
        break;      

           }

}


</script>



</html>


jquery reference在哪里?您今晚已经问了好几次这个问题。这是一个漂亮的答案!我甚至没有想到检查他是否安装了jQuery。我只是进入了自动驾驶。
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>