142、分割Frame的代码

142、分割Frame的代码

脚本说明:

把如下代码加入<body>区域中

<SCRIPT language="Javascript">

 

var top="<HTML>" + "\r" + "<TITLE>My Frame Page</TITLE>" + "\r" +"<HEAD></HEAD>"

var nf="<noframes>" + "\r" + "You need a frames capable browser to view this page."       + "\r" + "</noframes>" + "\r" + "</HTML>"

var f="</frameset>"

var bc="bordercolor=blue>"

var MW="marginwidth=0"

var MH="marginheight=0"

 

function framesa() {

document.Framer.Fillit.value=top

+ "\r" + "<frameset cols=50%,* "

+ " " + bc + "\r" + "<frame src=1.htm" +" " + "name=One"

+ "\r" + "scrolling=auto" + " " + MW + " " + MH + " " +  "noresize=yes>"

+ "\r" + "<frame src=2.htm" +" " + "name=Two"

+ "\r" + "scrolling=auto" + " " + MW + " " + MH + " " +  "noresize=yes>"

+ "\r" + f

+ "\r" + nf

}

function framesb() {

document.Framer.Fillit.value=top

+ "\r" + "<frameset rows=50%,* "

+ " " + bc + "\r" + "<frame src=1.htm" +" " + "name=One"

+ "\r" + "scrolling=auto" + " " + MW + " " + MH + " " +  "noresize=yes>"

+ "\r" + "<frame src=2.htm" +" " + "name=Two"

+ "\r" + "scrolling=auto" + " " + MW + " " + MH + " " +  "noresize=yes>"

+ "\r" + f

+ "\r" + nf

}

function framemixa() {

document.Framer.Fillit.value=top

+ "\r" + "<frameset cols=30%,* " + bc + " " + "noresize=yes>"

+ "\r" + "<frame src=1.htm" + " " + "name=One" + " " + "scrolling=yes"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + "<frameset rows=50%,*>"

+ "\r" + "<frame src=2.htm" + " " + "name=Two" + " " + MW

+ "\r" + MH + " " + "scrolling=yes>"

+ "\r" + "<frame src=3.htm" + " " + "name=Three" + " " + "scrolling=no"

+ "\r" + MW + " " + MH + " " + "noresize=no>"

+ "\r" + f

+ "\r" + f

+ "\r" + nf

}

function frames3v(){

document.Framer.Fillit.value=top

+ "\r" + "<frameset cols=33%,33%,*" + " " + bc

+ "\r" + "<frame src=1.htm name=One" + " " + "scrolling=auto"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + "<frame src=2.htm" + " " + "name=Two" + " " + "scrolling=auto"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + "<frame src=3.htm" + " " + "name=Three" + " " +

"scrolling=auto"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + f

+ "\r" + nf

}

function frames3h(){

document.Framer.Fillit.value=top

+ "\r" + "<frameset rows=33%,33%,*" + " " + bc

+ "\r" + "<frame src=1.htm name=One" + " " + "scrolling=auto"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + "<frame src=2.htm" + " " + "name=Two" + " " + "scrolling=auto"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + "<frame src=3.htm" + " " + "name=Three" + " " +

"scrolling=auto"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + f

+ "\r" + nf

}

function framemixb() {

document.Framer.Fillit.value=top

+ "\r" + "<frameset cols=30%,* " + bc + " " + "noresize=yes>"

+ "\r" + "<frameset rows=50%,*>" + "\r" +  "<frame src=1.htm" + " " +

"name=One"

+ " " + "scrolling=no" + " " + MW + "\r" + MH + " " + "noresize=yes>"

+ "\r" + "<frame src=2.htm" + " " + "name=Two" + " " + MW

+ "\r" + MH + " " + "scrolling=yes>"

+ "\r" + f

+ "\r" + "<frameset rows=50%,*>" + "\r" + "<frame src=3.htm" + " " +

"name=Three"

+ "\r" + "scrolling=no" +" " + MW + " " + MH + " " + "noresize=no>"

+ "\r" + "<frame src=4.htm" +" " + "name=Four" + " " + "scrolling=yes"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + f

+ "\r" + f

+ "\r" + nf

}

function Copy(){

if (document.Framer.Fillit.value=="") {

alert ('The top box is empty. Please enter a script by clicking one of the frames buttons.')

}

else {

document.Framer.Pastebox.value=document.Framer.Fillit.value

}

}

function view(){

if (document.Framer.Pastebox.value=="") {

alert ('The paste box is empty. Please enter a script by clicking the Copy/Edit button.')

return false;

}

else {

alert('If you like the results, remember to paste it to a text editor!')

boat = open ("","DisplayWindow")

see = parent.document.Framer.Pastebox.value

boat.document.write (see)

return true;

}

}

function Instruct(){

 

help =

open("","helpWindow","resizable=yes,location=no,toolbar=no,directories=no,status=no,scrollbars=yes,menubar=no,width=500,height=250")

help.document.write("<TITLE>Frame Builder Help</TITLE>")

help.document.write("<P><Center><B><FONT SIZE=+0><FONT COLOR='black'>Instructions</FONT></FONT></B></Center></P>")

help.document.write("<P>1. Load a frame script into the top box by clicking one of the 6 pre built frame scripts buttons.")

help.document.write("<P>2. Copy the script to the bottom box using the <B>Copy/Edit</B> button. Edit the script from the bottom box. If a mistake is made, a fresh copy will allways be available in the top box to compare or to reload.</P>")

help.document.write("<P><B>Editing:</B></P>")

help.document.write("<LI>Make sure to change the frame src=???.htm to YOUR pages and rename name=?? to suit.</LI>")

help.document.write("<LI>Change the width or height of the frames by changing frameset Cols/Rows=?%.</LI>")

help.document.write("<LI>Deleting noresize=yes allows movable frames.</LI>")

help.document.write("<LI>Deleting bordercolor defaults to the Netscape grey bars.</LI>")

help.document.write("<LI>Changing bordercolor to border=no hides the bars.</LI>")

help.document.write("<LI>Changing scrolling=??? to auto or yes allows PAGE scrolling.</LI>")

help.document.write("<P>3. When satisfied with your changes in the bottom box, hit <b>View</b> to see the frames in a new window.</P>")

help.document.write("<P>4. Hit your browser'\s close option to return to the work window.</P>")

help.document.write("<P>5. When happy with how the frames look and operate, paste the script to a text editor. <B>Save it as an .htm file.</B></P>")

help.document.write("<P><CENTER><FORM><INPUT TYPE='button' VALUE='OK' onClick='window.close()'></CENTER></FORM></P>")

help.document.bgColor=('deepskyblue')

help.document.close()

}

</SCRIPT>

<DT><FORM Name="Framer"></DT>

<TABLE BORDER=1 >

<TR>

<TD>

<DT><INPUT Type=button Value="2 Vertical" onClick="framesa()"></DT>

<DT><INPUT Type=button Value="3 Vertical" onClick="frames3v()"></DT>

<DT><INPUT Type=button Value="2 Horizontal" onClick="framesb()"></DT>

<DT><INPUT Type=button Value="3 Horizontal" onClick="frames3h()"></DT>

<DT><INPUT Type=button Value="3 Mixed" onClick="framemixa()"></DT>

<DT><INPUT Type=button Value="4 Mixed" onClick="framemixb()"></DT>

</TD>

<TD VALIGN=TOP>

<DT><TEXTAREA Name=Fillit COLS="56" ROWS="6"></TEXTAREA></DT>

<CENTER><DT><INPUT Type=button Value="Instructions" onClick="Instruct()"></DT></CENTER>

</TD>

</TR>

<TR>

<TD>

<DT><INPUT Type=button Value="Copy/Edit" onClick="Copy()"></DT>

<DT><INPUT Type=button Value="Start Over" onClick="alert('Misfire? No problem, a new copy will be pasted to the bottom box. Good Luck!');Copy()"></DT>

<DT><INPUT Type=button Value="Clear All" onClick="reset()"></DT>

</TD>

<TD VALIGN=TOP>

<DT><TEXTAREA Name="Pastebox" COLS="56" ROWS="6"></TEXTAREA></DT>

<CENTER><DT><INPUT Type=button Value=" View It! "

onClick="view()"></DT></CENTER>

</TD>

</TR>

</TABLE>

</FORM><P>

</FONT></CENTER>

Write a comment

Comments: 0