Go4Expert

Go4Expert (http://www.go4expert.com/)
-   JavaScript and AJAX (http://www.go4expert.com/forums/javascript/)
-   -   VBscript boolean function causes Javscript to bomb (http://www.go4expert.com/forums/vbscript-boolean-function-causes-t13267/)

calgarychinese 26Aug2008 02:14

VBscript boolean function causes Javscript to bomb
 
Hi there

I have a server-side VB that runs at the beginning of the asp page, and it returns a result set, call it loResultSet.

In the client side javscript, I was trying to check to see if this result set is nothing or not.

if (<%=(loResultSet is nothing)%>)

{

// javscript code

}



However it bombs because that (loResultSet is nothing) returns "True", as opposed to "true", and Javascript doesn't recognize True.

I know this is a dumb question, but how would you fix this, and I mean, not in a hack way, such as

if (%=(loResultSet is nothing)%>.toString().toLowerCase())



Many thanks appreciated.

CC

pradeep 23Sep2008 19:10

Re: VBscript boolean function causes Javscript to bomb
 
Code: ASP

if (eval("<%=(loResultSet is nothing)%>%>".toString().toLowerCase()))

{

// javscript code

}


Try this!

calgarychinese 23Sep2008 20:54

Re: VBscript boolean function causes Javscript to bomb
 
Hi pradeep, however how is your solution different than mine except for the eval part you added? (I was actually hoping there would be some standard function to do that, for us to manipulate the results like this looks a little counter-productive - I guess that's the diff between javascript and vbscript...)

Thanks


All times are GMT +5.5. The time now is 18:09.