javascript & asp

Results 1 to 2 of 2

Thread: javascript & asp

  1. #1
    cheril Guest

    Default javascript & asp

    How do I access my javascript variables in asp or it let me know.<BR>Also what is return true & return false do in javascript functions & by default is it return false.<BR>Thanx for reading<BR>

  2. #2
    Karl Guest

    Default RE: javascript & asp

    I don&#039t think variables are interchangable between Javascript and Vbscript. only between JScript and VBscript.<BR><BR>let&#039s say you have a javascript function called "myFunc()" and it returns True, you could then do:<BR><BR>var ReturnValue;<BR>ReturnValue = myFunc();<BR><BR>in which case ReturnValue would then equal to True. Return values (and they can be boolean (true/false), integers (123454..), floats, strings and whatever else), are just a way to return a value from a function. If youd on&#039t specify a return value, nothing is returned.<BR><BR>A good example would be in form validation.<BR><BR>something along the lines of :<BR><BR>if (something.length == 0){<BR> alert("Must enter something");<BR> return false;<BR>}<BR> return true;<BR><BR>It&#039s important to note that as soon as your function reaches a "return" immediately exists the function.<BR><BR>So in the above example, if the field is left blank, we alert the user, and return false WHICH IMMEDIATLY EXISTS THE FUNCTION, so the "return true;" statement is NEVER executed.<BR><BR>on the other hand, if the user did enter something, only the "return true" is executed.<BR><BR>Another way of doing it would be:<BR>if (something.length == 0){<BR> alert("Must enter something");<BR> return false;<BR>}else<BR> return true;<BR><BR>although, there&#039s absolutely no point in doing it this way..for the reason I exaplained above.<BR><BR>Hope this helps.<BR><BR>karl

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts