faqts : Computers : Programming : Languages : Asp : ASP/VBScript : Functions

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

16 of 31 people (52%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How do I create a function that will save the HTML page to a database?

Aug 22nd, 2001 02:56
Simon Burnett, jacque leavitt,


To save HTML to a database field I used a DIV block to encapsulate the 
HTML.
For example:
<DIV name=divMyHTML>
  <TABLE><TR><TD>Hello There</TD></TR></TABLE>
</DIV>
I used a function called from the onsubmit attribute of my FORM. This 
function copied the DIV's InnerHTML property value into a hidden field 
which was submitted and inserted into the databsae field.
I had issues referencing the DIV element sometimes - was a bit of a 
nightmare but if you are using one window and no frames you should be 
ok referencing it with <divname>.innerHTML
remember to clean it up the SQL before inserting, making sure any 
apostrophes are replaced with two apostrophes so ASP can parse them ok.
If its the ENTIRE page you need to save then try looking at the 
spidering technique that gets the HTML for a web page. Don't know it 
off hand but a quick search should reveal if for you.
Hope it helps



© 1999-2004 Synop Pty Ltd