View Single Post
  #1 (permalink)  
Old June 20th, 2008, 09:30 AM
deean deean is offline
Authorized User
 
Join Date: Jun 2008
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default Access ASP code inside Javascript

Hello,

I have a problem. I have ASP code and Javascript code. Now, I want to access ASP code inside javascript code.

Here is the ASP code:
<%
CONST C_prefix = "contains(.,'"
CONST C_midfix = "') or contains(.,'"
CONST C_suffix = "')"

Function CreateContainsList( fromStr )
    Dim temp, re
    ' the regexp ensures that multiple spaces become single spaces
    Set re = New RegExp
    re.Pattern = "\s+"
    re.Global = True
    ' so get an array of words via split...
    temp = Split( re.Replace( Trim(fromStr), " " ), " " )
    ' and make it into the contains list via join and helpers
    CreateContainsList = C_prefix & Join( temp, C_midfix ) & C_suffix
End Function

demo = " My Little Black Book "

path = "form/document[" & CreateContainsList(demo) & " ]//*"

Response.Write "<pre>" & demo & "" & path & "</pre>"
%>

And I want to print variable "demo" inside javascript.

I tried like this but the demo does not print out.
<script type="tex/javascript">
document.write(demo);
</script>