Languages :: ASP :: VBS :: ASP save funcation, only content div |
|||
| By: pazzledesign |
Date: 28/09/2008 02:04:30 |
Points: 20 | Status: Open |
|
Hi i have a little page on my sever (it's a windows server so i have to use ASP) I only want to edit a specific portion of the website <div id="content"> <span>NEWS</span> <p>DEC 20th - Me and him</p> <p>DEC 28th - Our Vacation</p> <p>DEC 29th - New Year</p> <p> </p> </div> Bur right now my code displays the whole sites HTML(and i only want to edit the above content) My script: <form method="post" action="saveasp.asp"> <textarea style="width:600px; height:600px;" name="bytheway"> <% ' Target page to be read page_to_read="news1.htm" ' Create a server object set fso = Server.createobject("scripting.filesystemobject") ' Set the path to document to be read set act = fso.opentextfile(server.mappath(page_to_read)) ' Read the contents of the document to the ' read_text variable read_text = act.readall ' Close the server object act.close ' Write the inputted text out to the browser ' and html encode it to display as source ' enclosed in <pre> tags to display as read response.write "<body>" & server.htmlencode(read_text) & "</body>" %> </textarea> <input type="submit" method="POST" value="Submit" name="save"> </form> and the save script <% set fsoo = Server.createobject("scripting.filesystemobject") Dim name name = Request.Form("bytheway") Response.Write(name) %> Can someone advise me how i could only display the <content> div instead of the whole html In the same text area Thanks |
|||
| By: VGR | Date: 29/09/2008 01:37:25 | Type : Comment |
|
| ok. change this : response.write "<body>" & server.htmlencode(read_text) & "</body>" into : response.write "<body><div id="content"> <span>NEWS</span> " & server.htmlencode(read_text) & "</div></body>" As a side note, I also use a Windows webserver (as millions of *AMP users do) and I use Apache and PHP, not IIS and ASP. You don't "have to" use ASP ;-) ASP is since long deprecated. Moreover, PHP is much more easier to use. |
|||
| By: pazzledesign | Date: 29/09/2008 04:27:41 | Type : Comment |
|
| It gives me an error Microsoft VBScript compilation error '800a0401' Expected end of statement /news/hello.asp, line 21 response.write "<body><div id="content"> <span>NEWS</span> " & server.htmlencode(read_text) & "</div></body>" ----------------------------------^ Any ideas |
|||
|
Do register to be able to answer |
|||
| Add This Article To: | |||
| |
|
|
|
| |
|
|
|








