convert visual basic 'IF' statement to JavaScript

Discussion in 'JavaScript' started by Sushi_Master, Nov 9, 2005.

  1. #1
    Hi guys

    Just a quick one for those of you who are good with JavaScript.

    Can you convert this Visual Basics IF statement into JavaScript for me please. I've had a few goes at doing it myself but i must have had the syntax wrong.

    All help is very much appreciated. Thanks, Sam.

    Just a quickie
    <%
    	if n > 0 then
    		oRsAnswers.Move(nSelected - 1)
    		Response.Write oRsAnswers ("Answers")
    	end if
    %>
    Code (markup):
     
    Sushi_Master, Nov 9, 2005 IP
  2. torunforever

    torunforever Peon

    Messages:
    414
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you're asking how to do a database recordset operation in javascript, then it's not possible. The ASP code you posted is run server-side. Javascript is run client-side, and doesn't have access to your database.

    If you're just asking how to write an if statement, then:

    
    <script type="text/javascript">
    if (n > 0) {
    // do something, but not if that something deals with db recordsets
    }
    </script>
    
    Code (markup):
     
    torunforever, Nov 9, 2005 IP