ÈÃASP.Net HTMLÒ³Ãæ´úÂë ÇåˬÆðÀ´
×Ô´ÓÓÃÁË ASP.Net MVCºó¾Íϲ»¶ÉÏÁËËü £¬ÒòΪMVC¶Ô·þÎñÆ÷¿Ø¼þµÄÒÀÀµ´ó´ó¼õÉÙ£¬ËüÉú³ÉµÄHTMLÒ³Ãæ¾Í±ÈWebFormÇåˬ¶àÁË£¬¼ÓÔØËÙ¶ÈÓÐÁËÃ÷ÏԵĸÄÉÆ¡£
µ«¶ÔÓÚÒ³ÃæÖÐÄÚǶscript£¬»¹ÊDz»Äܳ¹µ×µÄ±ÜÃ⣬È磺
<script type="text/javascript" language="javascript">
//<!--
function DepositPage() {
// ÕâÊÇÒ»¸öµÚ3·½µÄWebControl,ÓÉÓÚÊÇ·þÎñÆ÷¿Ø¼þ£¬ÊÜMasterPageÓ°Ïì,ËüµÄ¿Í»§¶ËID²¢²»ÊÇÈ·¶¨µÄ¡£
this.ctrlRadGrid = "#<%= ctrlRadGrid.ClientID %>";
// ÕâÊÇÒ»¶ÎÓÖ³ôÓÖ³¤µÄJSON£¬´ÓModalÖд«µÝ¹ýÀ´
this.accounts = <%= Modal.JSON %>;
// .............................
}
new DepositPage();
// -->
</script>
ÊÇ·ñÓÐÒ»ÖÖ·½·¨¿ÉÒÔ½«Õâ¶ÎJS²»ÄÚǶÔÚHTMLÖУ¬Ê¹ÓÃ<script src="">±ê¼Ç´ÓÍⲿÎļþ¼ÓÔØ?
´ð°¸Êǿ϶¨µÄ£¬Í¨¹ý×Ô¶¨ÒåWebControlÍêÈ«¿ÉÒÔʵÏÖ£¬ÓÐÈçÏÂWebControl
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
[ParseChildren(false)]
public class ExternalJavascriptControl : WebControl
{
private string SafeFilenamePrefix
{
get
{
return Regex.Replace( this.ClientID
, "(\\\\|\\/|\\:|\\*|\\?|\\\"|\\<|\\>|\\|)"
, "_"
, RegexOptions.ECMAScript | RegexOptions.Compiled
);
}
}
protected override void Render(HtmlTextWriter writer)
{
if (!Visible)
return;
try
{
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter htw = new HtmlTextWriter(sw))
{
base.Render(htw);
// get the rendered content
string rendered = sw.ToString();
// remove the script tag if exist
rendered = Regex.Replace(rendered
, @"(<[\s\/]*script\b[^>]*>)"
, string.Empty
, RegexOptions.ECMAScript | RegexOptions.Compiled | RegexOptions.IgnoreCase
);
// get the file pa
Ïà¹ØÎĵµ£º
·þÎñÆ÷¶Ë½Å±¾¿é£º
<script runat="server">
int my = 10;
</script>
·ÖÉ¢µÄ½Å±¾
<%= my.ToString() %>
<% Response.Write(my); %>
.aspxÎļþµÄÄÚÈݱ»½âÎöÎ ......
ÔÚÒ³ÃæAÖмÓÔØÁËÒ»¸öflashÎļþa.swfºó£¬a.swfµÄ·¾¶¾Í»á±ä³ÉAËùÔڵķ¾¶¡£Èç¹ûÔÚa.swfÖÐÒª¼ÓÔØb.swfʱ£¬ÕâʱºòµÄ·¾¶¾ÍÒª½øÐÐÏàÓ¦µÄ´¦Àí¡£
±¾À´°´ÕÕa.swfºÍb.swfÔÚ´ÅÅÌÖеĴæ·Å·¾¶£¬aÖмÓÔØbÊǺܼòµ¥µÄ£¬µ«ÊÇÏÖÔÚa.swfÒѾ±ä³ÉÒ³ÃæAËùÔڵķ¾¶ÁË£¬Èç¹û»¹ÊÇ°²×°ÔÀ´µÄ·¾¶È¥¼ÓÔØb.swf¾Í¼ÓÔز»ÁËÁË¡£Òò´Ë¿ÉÒÔÔÚas´úÂë¼ÓÔØb ......
1 HTMLÊdz¬Îı¾±ê¼ÇÓïÑÔ£¬ÊÇä¯ÀÀÆ÷µÄ"ĸÓï"£¬ÎÒÃÇËù¿´µ½µÄÍøÒ³¾ÍÊÇä¯ÀÀÆ÷¶ÔHTML½øÐнâÊ͵Ľá¹û¡£¶øXHTMLÊÇ¿ÉÀ©Õ¹³¬Îı¾±ê¼ÇÓïÑÔ£¬ÊÇÒ»ÖÖеĸü¼Ó½á¹¹Á¼ºÃµÄHTMLÓïÑÔ¡£
2¡¢HTMLÖ÷ÒªÊǸ÷ÖÖ¸÷ÑùµÄÔªËØ£¬Ñ§Ï°HTML¾ÍÊÇѧϰʹÓÃÕâЩԪËØ¡£
3¡¢ÔªËØÒ» ......
Èç¹ûÄãÒѾÓн϶àµÄÃæÏò¶ÔÏ󿪷¢¾Ñ飬Ìø¹ýÒÔÏÂÕâÁ½²½£º
µÚÒ»²½¡¡ÕÆÎÕÒ»ÃÅ.NETÃæÏò¶ÔÏóÓïÑÔ£¬C#»òVB.NET ÎÒÇ¿ÁÒ·´¶ÔÔÚûϵͳѧ¹ýÒ»ÃÅÃæÏò¶ÔÏó(OO)ÓïÑÔµÄÇ°ÌáÏÂȥѧASP.NET¡£ ASP.NETÊÇÒ»¸öÈ«ÃæÏò¶ÔÏóµÄ¼¼Êõ£¬²»¶®OO£¬ÄǾø¶Ôѧ²»ÏÂÈ¥!
¡¡¡¡µÚ¶þ²½¡¡¶Ô.NET FrameworkÀà¿âÓÐÒ»¶¨µÄÁ˽⠿ÉÒ ......
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ͼƬ»¬¶¯.aspx.cs" Inherits="ASP.net.ͼƬ»¬¶¯" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  ......