1、动态广告:
<marquee οnmοuseοver="this.stop()" οnmοuseοut="this.start()" scrollamount="1" scrolldelay="60" direction=up height=150>
<TABLE class="menu" height="198" cellSpacing="0" cellPadding="0" align="center" border="0">
<TBODY>
<TR>
<TD height="172">
你好!
</TD>
</TR>
</TBODY>
</TABLE>
</marquee>
2、当鼠标移到链接字体上时,显示提示框:
只要在链接属性里加上title属性即可。例如:
string title = "" ;
title = "标题:" + _XWZBT.ToString()+" /n发布时间:"+ _FBSJ + " /n点击次数:" + _DJCS.ToString() ;
<a href="index.aspx" title='" + title + "' target="_black">新闻标题</a>
其中 target="_black"表示单独弹出一个页面。
3、自动显示下拉菜单:
<SCRIPT>
<!--
function doPopUp()
{
var Durl = window.location;
var Dname="市民首页";
document.all.pagecount.src= "/PortalApp/pagecount/pagecount.jsp?Durl="+Durl+"&Dname="+Dname+"&Dtype=1";
}
function MM_findObj(n, d)
{
var p,i,x;
if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length)
{
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function expands(myid)
{
if(document.all[myid].style.display=="none")
{
document.all[myid].style.display="block"
for(var i=1;i<=7;i++)
{
if(("pic"+i)!=myid)
document.all["pic"+i].style.display="none"
}
}
else
{
document.all[myid].style.display="none"
}
}
function MM_showHideLayers()
{
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3)
if ((obj=MM_findObj(args[i]))!=null)
{
v=args[i+2];
if (obj.style)
{
obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v;
}
obj.visibility=v;
}
}
//-->
</SCRIPT>
//---------------------------------创建菜单-------------------------------------------------------------------------------------------------------------------
public string CreateMen( string image ,int _width )
{
string _Html = "" ;
DataSet DS = new DataSet("Menu");
DataTable DT = new DataTable("PowerMenu");
DataColumn MenuTxt = new DataColumn("MenuTxt",typeof(string));
DataColumn MenuID = new DataColumn("MenuID" ,typeof(string));
DataColumn TZDZ = new DataColumn("TZDZ" ,typeof(string));
DS.Tables.Add(DT);
//----------------------------------------------------------------
SqlConnection TheSqlConnection = new SqlConnection();
TheSqlConnection.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["MIS"].Trim();
SqlCommand myCommand = new SqlCommand();
myCommand.CommandText = " Select isnull(LMBH,'') as MenuID , isnull(LMMC,'') as MenuTxt , isnull(TZDZ,'') AS TZDZ From TB02 Where (SFYC = '1') Order By LMXH ";
myCommand.Connection = TheSqlConnection;
System.Data.SqlClient.SqlDataAdapter DA = new SqlDataAdapter();
DA.SelectCommand = myCommand;
try
{
TheSqlConnection.Open();
DA.Fill(DS,"PowerMenu");
foreach( DataRow DR in DT.Rows )
{
string MenuTxtString = DR["MenuTxt"].ToString();
string MenuIDString = DR["MenuID"].ToString() ;
string TZDZString = DR["TZDZ"].ToString() ;
_Html = _Html + CreateMenuItem(MenuIDString , MenuTxtString , TZDZString , image, _width , TheSqlConnection );
}
TheSqlConnection.Close();
DT.Rows.Clear();
DS.Dispose();
}
catch( Exception ErrMess )
{
string ls = ErrMess.ToString();
if( TheSqlConnection.State == System.Data.ConnectionState.Open )
{
TheSqlConnection.Close();
}
DT.Rows.Clear();
DS.Dispose();
_Html = "";
}
return _Html;
}
private string CreateMenuItem( string MenuID , string MenuTxt , string TZDZ ,string image , int _width , SqlConnection TheSqlConnection )
{
string _Html = "" ;
string OldMenuID = MenuID ;
MenuID = "M" + MenuID;
string MenuItemsHtml = GetChildMenu( TheSqlConnection , OldMenuID );//得到子菜单的行
//width='65'
_Html = _Html + " <td width=88 height=30 valign=middle background='" + image + "'οnmοuseοver=" + '"' + "MM_showHideLayers('" + MenuID + "','','show') " + '"' + " onmouseout = " + '"' + "MM_showHideLayers('" + MenuID + "','','hide')" + '"' + "> /t/n ";
if( TZDZ.Trim() != "" )
{
_Html = _Html + " <div align='center' class='style1'><A href='" + TZDZ + "?NewType=" + OldMenuID + "'><font color='#ffffff'>" + MenuTxt + "</font></A></div> /t/n ";
}
else
{
_Html = _Html + " <div align='center'><font color='#ffffff'>" + MenuTxt + "</font></div> /t/n ";
}
_Html = _Html + " <DIV id='" + MenuID + "' οnmοuseοver=" + '"' + "MM_showHideLayers('" + MenuID + "','','show')" + '"' + " style='VISIBILITY: hidden; WIDTH: 90px; POSITION: absolute' /t/n ";
_Html = _Html + " οnmοuseοut=" + '"' + "MM_showHideLayers('" + MenuID + "','','hide')" + '"' + "> /t/n ";
if( MenuItemsHtml == "" )//如果没有子菜单
{
}
else
{
_Html = _Html + " <TABLE οnmοuseοver=" + '"' + "MM_showHideLayers('Layer222','','show')" + '"' + " οnmοuseοut=" + '"' + "MM_showHideLayers('Layer222','','hide')" + '"' + " /t/n ";
_Html = _Html + " cellSpacing='0' cellPadding='0' width='83' border='0' bgcolor='#f0f8ff'> /t/n ";
_Html = _Html + " <TBODY> /t/n ";
_Html = _Html + " <TR> /t/n ";
_Html = _Html + " <TD vAlign='top' width='28' height='9'></TD> /t/n ";
_Html = _Html + " </TR> /t/n ";
_Html = _Html + " <TR> /t/n ";
_Html = _Html + " <TD> /t/n ";
_Html = _Html + " <TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'> /t/n ";
_Html = _Html + MenuItemsHtml + " /t/n ";
_Html = _Html + " <TBODY> /t/n ";
_Html = _Html + " </TBODY> /t/n ";
_Html = _Html + " </TABLE> /t/n ";
_Html = _Html + " </TD> /t/n ";
_Html = _Html + " </TR> /t/n ";
_Html = _Html + " </TBODY> /t/n ";
_Html = _Html + " </TABLE> /t/n ";
}
_Html = _Html + " </DIV> /t/n ";
_Html = _Html + " </td> ";
return _Html;
}
private string GetChildMenu( SqlConnection TheSqlConnection , string MenuID )
{
string _Html = "";
SqlCommand myCommand = new SqlCommand();
myCommand.CommandText = " Select LMBH , LMMC , IsNull(TZDZ,'') AS TZDZ From TB02 Where FLMBH = @FLMBH Order By LMXH DESC ";
myCommand.Parameters.Add("@FLMBH",System.Data.SqlDbType.VarChar,50);
myCommand.Parameters["@FLMBH"].Value = MenuID;
myCommand.Connection = TheSqlConnection;
System.Data.SqlClient.SqlDataReader ReadInfo = null;
try
{
ReadInfo = myCommand.ExecuteReader();
while( ReadInfo.Read() )
{
object _LMBH = null , _LMMC = null , _TZDZ = null ;
_LMBH = ReadInfo["LMBH"];
if( _LMBH == null || _LMBH == System.DBNull.Value )
{
_LMBH = "";
}
_LMMC = ReadInfo["LMMC"];
if( _LMMC == null || _LMMC == System.DBNull.Value )
{
_LMMC = "";
}
_TZDZ = ReadInfo["TZDZ"];
if( _TZDZ == null || _TZDZ == System.DBNull.Value )
{
_TZDZ = "";
}
_Html = _Html + " <TR> /t/r";
_Html = _Html + " <TD vAlign='bottom' align='center' height='22'> /t/r" ;
if( _TZDZ.ToString().Trim() == "" )
{
_Html = _Html + _LMMC + " /t/r" ;
}
else
{
_Html = _Html + " <A href='" + _TZDZ.ToString() + "?NewType=" + _LMBH + "'>" + _LMMC + "</A> /t/r" ;
}
_Html = _Html + " </TD> /t/r" ;
_Html = _Html + " </TR> /t/r" ;
}
ReadInfo.Close();
}
catch
{
if( ReadInfo != null && !ReadInfo.IsClosed )
{
ReadInfo.Close();
}
return "";
}
if( _Html.Trim() == "" )
{
return "" ;
}
else
{
_Html = _Html + " <TR> /t/r";
_Html = _Html + " <TD vAlign='bottom' align='center' height='22'> /t/r";
_Html = _Html + " /t/r";
_Html = _Html + " </TD> /t/r";
_Html = _Html + " </TR> /t/r";
}
return _Html ;
}
//--------------------------------------图片新闻------------------------------------------------------------------------
/// <summary>
/// 构造新闻滚动图片动画
/// </summary>
/// <param name="_Width">宽</param>
/// <param name="_Height">高</param>
/// <param name="_TimeOut">速度</param>
/// <param name="_Effect">未知</param>
/// <param name="_TitleLen">说明文字</param>
/// <returns></returns>
public string PictureNewsCartoon( int rowcount , int _Width , int _Height ,int text_height )
{
string _Html = "";
CreateHtml create = new CreateHtml();
_Html = create.CreatePictureNewsCartoonWQZONE(rowcount , _Width , _Height , text_height);
create = null;
return _Html;
}
/// <summary>
/// 构建图片新闻动画
/// </summary>
/// <returns></returns>
public string CreatePictureNewsCartoonWQZONE( int rowcount , int _Width , int _Height , int _text_height )
{
string _Html = "",Pics ="",Links ="",Texts ="",SYTP="",TZDZ="",XWBT = "",XWBH="";
int focus_width =_Width;
int focus_height=_Height;
int text_height =_text_height;
int swf_height =focus_height + text_height;
_Html = _Html + " <SCRIPT language=JavaScript> /t/r";
_Html = _Html + " <!-- /t/r";
SqlConnection TheSqlConnection = new SqlConnection();
TheSqlConnection.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["MIS"].Trim();
SqlCommand myCommand = new SqlCommand();
myCommand.CommandText = " Select top " + rowcount.ToString() + " TB99.SYTP AS SYTP,TB99.XWBH AS XWBH , TB02.TZDZ AS TZDZ,TB99.XWZBT AS XWZBT From TB99 Left Outer Join TB02 On ( TB99.LMBH = TB02.LMBH ) Where (SFTP = '1') And ( TB99.SHBZ = '1' ) And ( TB99.SCSJ > GetDate() ) And ( RTrim(TB99.SYTP) <> '' ) Order By TB99.FBSJ DESC " ;
myCommand.Connection = TheSqlConnection;
System.Data.SqlClient.SqlDataReader ReadInfo = null;
try
{
TheSqlConnection.Open();
ReadInfo = myCommand.ExecuteReader();
while( ReadInfo.Read() )
{
object ReturnObject ;
//---新闻编号
ReturnObject = ReadInfo["XWBH"];
if( ReturnObject == System.DBNull.Value )
{
ReturnObject = "";
}
XWBH = ReturnObject.ToString();
//---新闻标题
ReturnObject = ReadInfo["XWZBT"];
if( ReturnObject == System.DBNull.Value )
{
ReturnObject = "";
}
XWBT = ReturnObject.ToString();
if( XWBT.Length > 15 )
{
XWBT = XWBT.Substring(0,15) + "...";
}
if( Texts.Trim() != "" )
{
Texts = Texts + "|" + XWBT;
}