To control pop-up windows---Use the file access component tips for example

Source: Internet
Author: User
Tags button type ini
access| Popup | tips | Control and I learned to use the background program to programmatically popup windows---Modify a file instance with the Files Access component
We often need to do a pop-up window on the home page (in fact I hate this stuff), the general approach is to add such a onload= in <body> "window.open (' new-window.htm ', ', ', ' width=300, height=250 ') " Where new-window.htm is the file name of the newly opened window page, the back page is width and height, but if it is a will to this window, a will not, and often change the contents of this window, that is really the wife trouble (Ayu head so, gas dead me, one day unexpectedly changed n times, so that Dmitri Trenin, wrote this small program).
Basic ideas:
1. To do such a program, the key is to accurately find <body> mark on the home page, and in which add onload= "window.open (' new-window.htm ', ', ', ' width=300,height=250 ')", To become <body onload= "window.open (' new-window.htm ', ', ' width=300,height=250 ')", how can we find <body>? Through observation found that the entire home page on a <body&gt, using the INS function to find <body> in the page starting position plus five to get the position of the statement should be inserted. Of course, you also have to be able to delete onload= "window.open (' new-window.htm ', ', ', ' width=300,height=250 ')", which is to delete the sentence from "<body" to "" "" ", To undo the pop-up window, I found that there is only one "'" in the page, and the first one to look back at least from the first is what we want "".
2. To create a file, named New-window.htm, this is relatively simple, look at the following code to know.
Production process:
With the idea, we started the next.
First, make a page of input parameters, file name, newwindow.asp on this page, there are six text boxes, the first name to enter the window name, the second name is Co1, to fill out the page background, the third name is CO2 to fill in the text color, the fourth name is BG, Used to fill in the bottom chart file name, the fifth name is W, to fill out the width of the pop-up window, the fifth named H, to fill out the width of the pop-up window. Also, a scrolling text box named LR is used to fill in the content to be published in the pop-up window. Create three more buttons, the first is to create a pop-up window, the second is a preview, the third is the Undo pop-up window, the button type is submitted, the name is B1,B2,B3 respectively. After the form is submitted by the newwindow1.asp file, the code for the file is as follows (you can also write yourself as described above):
<!--#include file= "Window.ini"-->
<title> Excellent computer website Express www.zydn.net</title>
<body bgcolor= "#E0F0F8" >
<div align= "center" >
<p> make pop-up window, please enter relevant information <br>

<form method= "POST" action= "newwindow1.asp" >

<table border= "1" width= "100%" bordercolorlight= "#000000" cellspacing= "0" cellpadding= "4" bordercolordark= "# FFFFFF "bgcolor=" #A4D1E8 "style=" font-size:9pt ">
<tr><td> window title: </td><td colspan= "2" ><input type= "text" name= "name" size= "" style= "border : 1 Solid #6384C0 "value=" ></td> "<%=name111%>"
&LT;/TR&GT;&LT;TR&GT;&LT;TD valign= "top" > Window background:</td> <td><input type= "text" name= "Co1" size= "9" Style= "Border:1 solid #6384C0" value= "<%=co1%>" ></td>
<td> Bottom Chart: <input type= "text" name= "BG" size= "style=" border:1 solid #6384C0 "value=" <%=bglr%> "> </td> </tr>
&LT;TR&GT;&LT;TD valign= "Top" > Text color:</td> <td colspan= "2" ><input type= "text" name= "CO2" size= "9" Style= "Border:1 solid #6384C0" value= "<%=co2%>" ></td>
&LT;/TR&GT;&LT;TR&GT;&LT;TD valign= "top" > Window size:</td><td> width: <input type= "Text" Name= "W" size= "9" Style= "Border:1 solid #6384C0" value= "<%=w%>" > Pixel </td>
<td> High: <input type= "text" name= "H" size= "9" style= "Border:1 solid #6384C0" value= "<%=h%>" > Pixel </td > </tr>
&LT;TR&GT;&LT;TD valign= "top" > Window content: </td><td colspan= "2" ><textarea rows= "9" name= "LR" cols= "61" Style= "Border:1 Solid #6384C0" ><%=lr%></textarea></td>
&LT;/TR&GT;&LT;TR&GT;&LT;TD colspan= "3" align= "center" ><input type= "Submit" value= "View Effects" name= "B2" >< Input type= "Submit" value= "Create pop-up Window" Name= "B1" ><input type= "submit" value= "Undo pop-up Window" Name= "B3" ></td>
<p> used in the </tr></table><p> window content to indicate a newline </p>
</form></div>
</body>
Insert a file Newwindow.ini in the front, this file is used to record the last number you entered the parameters, the first time you use, as long as the file to fill in a few spaces.
Before the page input parameters submitted by the newwindow1.asp file to deal with, while we look at this file, while to explain the role of each sentence,
FileName: newwindow.asp, full text as follows:

<%patha=server. MapPath ("newwindow1.asp")
Patha=left (Patha,len (Patha)-14) ' * * * The above two are used to get the path where the file is located so that the file SystemObject object that is established by the file access component can then be read and created.
Name=request.form ("name")
Co1=request.form ("Co1")
Co2=request.form ("CO2")
W=request.form ("W")
H=request.form ("H")
Bg=request.form ("BG")
Lr=request.form ("LR") ' above these few words, to read the form submitted data,
B1=request.form ("B1")
B2=request.form ("B2")
B3=request.form ("B3") ' B1 b2 B3 respectively corresponds to the three buttons, if the user clicks the B1 button, B1 is not empty, we can judge by their value of which button the user in the end.
If lr= "" then Response.Redirect ever.asp?lr= you do not have input to display in the window,<br><br> what are you going to announce in the pop-up window? "' If the user does not enter the content, the display



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.