HTML里如何包含ASP文件
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head>
<body>
<%
response.write("nihao")
%>
</body>
</html>
--------------COOL.ASP
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>nihao</title>
</head>
<body>
<p>
<script language="javascript" src="cool.asp"></script>
</p>
</body>
</html>
-------------------nihao.html
怎么运行时并没有调用cool.asp输出nihao呢?
问题点数:20、回复次数:8Top
1 楼king2003(鱼)回复于 2006-03-13 12:51:06 得分 5
晕,得是JAVASCRIPT的语法呀!document.write("你好")Top
2 楼hanpoyangtitan(韩波洋)回复于 2006-03-13 13:18:38 得分 3
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head>
<body>
<%
response.write("document.write(""nihao"");")
%>
</body>
</html>
Top
3 楼tufun(白做了两年程序员还是那么菜)回复于 2006-03-13 13:29:02 得分 3
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head>
<body>
<%
response.write("<script>document.write(""nihao"")</script>;")
%>
</body>
</html>
Top
4 楼hanpoyangtitan(韩波洋)回复于 2006-03-13 13:32:31 得分 2
楼上的<script>标签就不要了
他这个页面用<script>调用的Top
5 楼csyu85(深情的一吻)回复于 2006-03-13 13:46:17 得分 2
ASP的好像不能这样调。Top
6 楼hanpoyangtitan(韩波洋)回复于 2006-03-13 14:16:25 得分 3
可以这样用
我做过用asp做的javascript脚本文件
// Document getSystemTime
function playSound()
{
document.getElementById("newLetter").insertAdjacentHTML("BeforeEnd","<span style=\"display:none\"><embed src=images/msg.wav width=\"0\" height=\"0\" autostart='-1'></span>");
}
function Ajax()
{
var ajax;
try{
ajax=new ActiveXObject("microsoft.XMLHTTP");
}
catch(e)
{
try{
ajax=new ActiveXObject("MSXML2.XMLHTTP");
}
catch(ee)
{
alert("初始化Ajax失败"+ee);
}
}
return ajax;
}
function initAjax()
{
var ajaxObj=Ajax();
ajaxObj.open("get","systemtime.asp",false,null,null);
ajaxObj.onreadystatechange=function(){
if(ajaxObj.status==200&&ajaxObj.readystate==4)
{
rt=ajaxObj.responseText;
sss=rt.split("@");
uu=sss[0].split("$");
pp=sss[1].split("$");
if(pp[0]=="time")
{
document.getElementById("newLetter").innerHTML= "<b>"+pp[1].substring(0,pp[1].lastIndexOf(":"))+"</b>";
}
else if(pp[0]=="message")
{
document.getElementById("newLetter").innerHTML=" 您有新的短信,请<a class='mess' href='mess/show.asp?id="
+pp[1]+"' target='main'>[查收]<img src=\"images/pub.gif\" border=0 alt=\"查看短信\"></a>";
playSound();
}
if(uu[0]=="user")
{
uinfo=uu[1].split("^");
uip=uinfo[1];
uid=uinfo[0]
if(uid=="<%=session("username")%>"&&uip=="<%=session("ip")%>")
{
alert("由于您违反了本系统的有关规定,特此,请您离开!\n如果您有和问题,请和管理员联系");
top.location.reload("quit.asp?method=close");
}
}
if(sss[2]!=""&&sss[2].indexOf("<%=session("username")%>")<=0)
{
pu=sss[2].split("$");
var newxmlhttp=Ajax();
newxmlhttp.open("get","show2all/apu.asp?u=<%=session("username")%>",false,null,null);
newxmlhttp.send();
var nnw=window.open("show2all/showpub.html","_blank","Width=200,Height=150,top=824;left=824");
nnw.pub.innerHTML="<center><table height=\"54\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"+
"<tr>"+
"<td>author:"+pu[1]+"</td>"+
"</tr>"+
"<tr>"+
"<td height=\"70\" width=\"150\">"+pu[2]+"</td>"+
" </tr>"+
"<tr>"+
"<td>"+" Edit by "+pu[0]+"</td>"+
"</tr>"+
"</table></center>"
}
}
}
ajaxObj.send();
}
setInterval("initAjax();",10000);
Top
7 楼Only_D(独眼肥兔)回复于 2006-03-13 15:01:40 得分 2
来晚了Top
8 楼sanshisong(三师兄)回复于 2006-03-13 15:57:16 得分 0
-_-! 谢谢大家,结帐! 人人有份,对的多分,捧场的朝阳有分Top




