|
Shorten Length of Database Text Displayed?
Here's my situation. I have a database set up and I need to display the information on a page. One of the fields can be rather lengthy. I want to set up a javascript function to shorten the length of the text that is displayed to no more than 25 characters of that field, not the actual length of the data that can be in the database. Here is the script that I have been messing around with. Any thoughts or help are greatly appreciated. Thanks - Richard
<script language="javascript">
function shorten(sString, sLength) {
if Len (sString) > sLength {
shorten = left(sString,sLength) & "...";
} else {
shorten = sString
}
}
function sOrg() {
sOrg = <%=(recordset1.Fields.Item("data").Value)%>
sOrg = shorten(sOrg,25)
}
sOrg()
document.write (sOrg)
</script>
Example of how I would like it to display if the length is more than 25 characters:
This database field has e...
|