Jump to content

string length between Javascript and ASP


joecool2005
 Share

Recommended Posts

Hi all,When I execute this,<% sub check(temp) dim varASP varASP="abc" Response.Write(len(temp)&" "&len(varASP)) end sub%><script> var varJS="abc" document.write('<%call check("'&varJS&'")%>')</script> Why the length of "temp" and "varASP" are different?Thx for your helpJoe

Link to comment
Share on other sites

Chances are the javascript variable is equal to 'undefined'When javascript has a problem setting the value of a variable it will set it to 'undefined'.Try changing this

 document.write('<%call check("'&varJS&'")%>')

to

 document.write('<%call check("' + varJS + '")%>')

Link to comment
Share on other sites

Also did that way before and same result. But I noticed something strange.When you do both cases you will get different resultdocument.write('<%call check("'+varJS+'")%>')"temp" is 9 and "varASP" is 3document.write('<%call check("' + varJS + '")%>')"temp" is 13 and "varASP" is 3??????Both of them are used withResponse.Write(len(Trim(temp))&" "&len(Trim(varASP)))

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...