解决方案 »
- css , javascript 网页系统导入的问题!
- 求JSP课程设计
- 上传附件的JS代码上传后提示"文档的顶层无效"的错误
- flex可以嵌入一个外部的swf 然后可以在外部控制swf的播放么?
- 一个很简单的问题,急求帮忙!javascript 中的alert执行不了!!!
- 弹出的窗口操作父窗口的列表框出错
- 看看你的程序思维,改一个非常用的程度
- 怎么把焦点设置到到表格当前行的下一行的第一个cells
- jquery IE8下 attr的bug? 怎么解决
- location.replace()的用法正确吗?在线等待。。。。
- 问一个火狐中取表中值的问题,急。。。。谢谢了
- jquery json 问题 求救?
------------------------------------------------------------------
index.jsp的代码:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head>
<body>
<html:link action="/quiz.do">开始</html:link>
<br>
</body>
</html>------------------------------------------------------------------------
struts-config.xml的内容:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd"><struts-config>
<form-beans >
<form-bean name="quizForm" type="com.exam.struts.form.QuizForm" /> </form-beans>
<global-exceptions />
<global-forwards>
</global-forwards>
<action-mappings >
<action
attribute="quizForm"
input="/form/quiz.jsp"
name="quizForm"
path="/quiz"
scope="request"
type="com.exam.struts.action.QuizAction">
<forward name="qsNotOver" path="/form/quiz.jsp" />
</action> </action-mappings>------------------------------------------------------------------------
quiz.jsp的内容:
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<html:html>
<head>
<title>竞赛题目</title>
<script type="text/javascript" src="jquery-1.3.2.min.js" /><script type="text/javascript">
$(function()
{
alert("ok");
});
</script>
</head>
<body>
<html:form action="/quiz">
<html:radio property="answer" value="1" styleId="answer1" /><html:errors property="answer"/><br/>
<html:radio property="answer" value="2" styleId="answer2" /><html:errors property="answer"/><br/>
<html:radio property="answer" value="3" styleId="answer3" /><html:errors property="answer"/><br/>
<html:radio property="answer" value="4" styleId="answer4" /><html:errors property="answer"/><br/>
<html:hidden property="id" value="${examQ[0].id}" /><html:errors property="id"/><br/>
<html:submit styleId="bt" value="下一题" />
</html:form>
</body>
</html:html>
---------------------------------------------------------------------------
index页面通过action可以正常跳转到quiz.jsp页面,但是quiz.jsp页面里的js代码(alert)却无法执行,大家帮帮忙啊~
就是alert的命令也无法运行啊
<html>
<head>
<title></title></head><body>
<script type="text/javascript">
alert("ok");
</script>
</body></html>
window.onload=function(){alert("ok");}
原quiz.jsp中,head标签里的代码是
<script type="text/javascript" src="jquery-1.3.2.min.js" /><script type="text/javascript">
$(function()
{
alert("ok");
});
</script>问题出在<script type="text/javascript" src="jquery-1.3.2.min.js" />,应为<script type="text/javascript" src="jquery-1.3.2.min.js"></script>,就可以运行了