1.有关页面框架。
在主页面设置几个框架页面,
<frameset rows="64,*,70%"> <frame name="header" scrolling="no" noresize target="main" src="title.htm"> <frame name="main" scrolling="auto" noresize src="search.htm"> <frame name="main1" src="bottem.htm"> <noframes> <body>
然后在请求页面中用如下:
<form method="GET" action="list.asp" target="main1"> //这种的处理有时与浏览器有关。当有几层的framset时他们之间并没有哪种层次关性,这里对名的应用不像在页面中那样有层次关系,就像页面中的id一样引用。
就可以把请求的结果页面放到相关的frame中,就不用更新请求的页面。
2。出于显示或美观的需要,有时需要框架能够动态的改变。 可以通过该改变外框架的设定来实现。可见如下实例:
首先在主框架中的代码:
<FRAMESET border=0 cols=166,* //设置宽度 frameBorder=0 frameSpacing=0 name=content> //设置名为content的frame <FRAME marginHeight=0 marginWidth=0 name=BoardMenu noResize scrolling=no //这样可以确保隐藏后不再占有空间 src="12.html"> <FRAME marginHeight=0 marginWidth=0 name=BoardMain noResize src="Right.jsp"></FRAMESET><noframes></noframes>
在对应的12.html中的如下:
<style type="text/css"> .np {COLOR: black; CURSOR: hand; FONT-FAMILY: Webdings; FONT-SIZE: 18px} </style> <script language="javascript"> function switchSysBar(){ if (switchPoint.innerText==3){ //根据span的innerText属性值来判断。 switchPoint.innerText=4 document.all("mnuList").style.display="none" //当要隐藏时,id属性为mnulist的标记不显示 top.content.cols="16,*" //改变外框架(名为content)的框架划分,从而达到隐藏的效果 } else{ //是上面过程的逆过程 switchPoint.innerText=3 document.all("mnuList").style.display="" top.content.cols="166,*" } } </script> <body leftMargin="10" topMargin="0" marginwidth="10" marginheight="0"> <table align="center" border="0" cellPadding="0" cellSpacing="0" height="100%" width="162"> <tr> <td bgColor="#FFFAF8" id="mnuList">//定义要隐藏的区域 <img src="image/catalog.jpg" width="120" height="88"/> reee </td> <td background="image/menuVertical.gif" bgColor="#ffffff" width="16"> <table border="0" cellPadding="0" cellSpacing="0"> <tr> <td align="middle" vAlign="center"> <span class="np" id="switchPoint" onclick="switchSysBar()" title="打开/关闭导航"> 3</span></td> //事件源 </tr> </table> </td> </tr> </table>
本程序采用对一些tag符定义id,然后利用对应的属性来改变属性值,从而达到某些显示效果。
3.特殊字符的处理
在XML中有一些特殊字符(例如:<,>,&,','),通常是不能出现在xml文档中,否则该文档就是不具备有效性的原则。
当用Msxml.DOMDocument处理时,它会自动把相关的特殊字符按规则转换成相应的字符,不必考虑特殊情况。
对于其他的非xml文档,常见的html文档中通常需要处理特殊字符,以在javaScript的处理为例,
见如下:
<SCRIPT language="javascript"> function viladiate() { var s=content.value; //获取某个表单域 //处理如下四种字符 s = s.replace(/\</g, "<"); s = s.replace(/\>/g, ">"); s = s.replace(/\"/g, """); s = s.replace(/\'/g, "&apos"); s = s.replace(/\&/g, "&"); content.value=s; //对内容重置 } </SCRIPT>
通常采用onmouseover+隐藏表单域或提交后验证替换(例:<input name="submit" type="submit" onClick="return viladiate()" value="提 交"/>),当然可以采用其他的办法来处理。
4.在xml用dom来处理是要注意
1)doc.documentElement获取根节点的。
2) Proot=doc.documentElement.childNodes.item(0);获取根节点的子节点。
在插入时时在获得的相关的节点下插入。要注意层次结构。
|