Jsp添加背景音乐无效 Html文件添加有效 为什么?
Html文件中代码如下:
<body>
<bgsound src="file:///E|/a.mp3" loop="-1" balance="0" />
</body>
运行有效
但是在Jsp文件中会出错,如何修改?? JSP中如何添加背景音乐???
路径错误,在jsp添加背景音乐时, <bgsound src=" <%= <%=request.getContextPath()%>%>music.mid" loop="-"> 必须要使用绝对路径,否则发布后网页无法播放背景音乐
src="file:///E|/a.mp3" 路径错误,要用你的request.getContextPath()作为src的头,最好音乐像你的jsp一样放在你的工程里面去,否则要配路径比较麻烦的。你把音乐文件当作一个jsp,然后在浏览器里面怎么找到这个jsp,就把浏览器里面的路径当作src的路径就可以。
<%@ page contentType="text/html; charset=gb2312"%>
<html>
<head>
<title>页头 </title>
</head>
<bgsound src=" <%= <%=request.getContextPath()%>%>mr.wav" loop="-">
<center>
<table border="0" width="100%" height="115" cellspacing="0" cellpadding="0">
<tr> <td> <img src="images/index/indexT.jpg"> </td> </tr>
</table>
相关问答:
我想登录后,如果登录成功就去执行某个页面
我现在的代码是这样的:
if(rs.next()){
session.setAttribute( "username" , user);
<jsp:include page="login.jsp" />// ......
我想用javabean实现计数
代码如下:
ComputerCount.java
package tom.jiafei;
import java.io.*;
public class ComputerCount{
int number=0;
boolean iscome=false;
File file=new ......
jsp中include.inc的作用是什么?
include.inc啥意思?没听说过
Java code:
<%include file="include.inc"%>加载网站目录include.inc文件内容
包含一个静态页面吧···
& ......
<html><head><title>[@title]</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<script language='javascript'>
function diyCheck ......