服務(wù)熱線
153 8323 9821
在實(shí)際開發(fā)中如新聞系統(tǒng)就需要利用js來調(diào)用某分類的新聞等.
非Codebehind版
Showjs.aspx
----------------------------
<%Response.Write ("document.write('output')")%>
Showjs.html
---------------------------
<script language="JavaScript" Src="Showjs.aspx"></script>
這樣就可以正常查看showjs.html輸出"output"
Codebehind版
用Vs.Net新建showjs.aspx然后把除此句以外的html代碼全部刪除
<%@ Page language="c#" Codebehind="showjs.aspx.cs" AutoEventWireup="false" Inherits="Hover.showjs" %>
然后在showjs.aspx.cs里Page_Load()里
Response.Write ("document.write('output')");
這樣就能正常輸出
否則在Showjs.html里調(diào)用此Showjs.aspx時(shí)會(huì)報(bào)腳本錯(cuò)誤了
因?yàn)楫?dāng)你查看showjs.aspx運(yùn)行時(shí)的html代碼你就明白了因?yàn)樗妮敵霾还馐莇ocument.write('output')
還包括aspx的默認(rèn)文檔的html代碼所以調(diào)用不了!