joecool2005 Posted April 19, 2006 Share Posted April 19, 2006 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 More sharing options...
aspnetguy Posted April 19, 2006 Share Posted April 19, 2006 what are the 2 lengths?have you tried this??? Response.Write(len(Trim(temp))&" "&len(Trim(varASP))) Link to comment Share on other sites More sharing options...
joecool2005 Posted April 19, 2006 Author Share Posted April 19, 2006 the length for "temp" is 9 and "varASP" is 3Also I tried with thisResponse.Write(len(Trim(temp))&" "&len(Trim(varASP)))same resultThx Link to comment Share on other sites More sharing options...
aspnetguy Posted April 19, 2006 Share Posted April 19, 2006 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 More sharing options...
joecool2005 Posted April 19, 2006 Author Share Posted April 19, 2006 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 More sharing options...
aspnetguy Posted April 19, 2006 Share Posted April 19, 2006 That is odd. I am not sure what to suggest Link to comment Share on other sites More sharing options...
aspnetguy Posted April 19, 2006 Share Posted April 19, 2006 Give this a try document.write('<' + '%call check("' + varJS + '")%' + '>') It may be trying to execute the ASP call at this line, it is a long shot, but might work. Link to comment Share on other sites More sharing options...
joecool2005 Posted April 19, 2006 Author Share Posted April 19, 2006 I tried to use your code like this<%sub check(temp)dim varASPvarASP="abc"Response.Write(len(Trim(temp))&" "&len(Trim(varASP)))end sub%><script>var varJS="abc"document.write('<' + '%call check("' + varJS + '")%' + '>')</script> And nothing was displayed Link to comment Share on other sites More sharing options...
pulpfiction Posted April 19, 2006 Share Posted April 19, 2006 Hi joe, I think this is the problem, the variable in the asp.when i tried line this it seemed to work, i dont know how or why....document.write('<%call check("abc")%>') Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now