How to call Function

Results 1 to 2 of 2

Thread: How to call Function

  1. #1
    wini Guest

    Default How to call Function

    I have javascript code as follows.<BR>&#060;script LANGUAGE="JavaScript"&#062;<BR>var total=1;<BR>var db = new Array();<BR>call getData();<BR><BR>function getData(){<BR>x= "&#060;%=Adata%&#062;";<BR>array3 = x.split("#");<BR>}<BR><BR>I have some more functions after this.<BR>This call getData does not work. How do I call this function within JavaScript.

  2. #2
    Join Date
    Dec 1969

    Default RE: How to call Function

    (1) The function should be defined *BEFORE* you use it.<BR><BR>(2) You NEVER use the keyword "CALL" in JS code.<BR><BR>(3) That function won&#039;t do anything useful. It will split up the string you put into the x variable, but it will put it in an array that exists *ONLY* inside the function. After you call the function, the array will disappear.<BR><BR>(4) If all you want is an array, why make it a string and then split it up? Why not just:<BR><BR>&#060;SCRIPT ...&#062;<BR>array3 = new Array( &#060;% = Split(Adata,#) %&#062; );<BR>&#060;/SCRIPT&#062;<BR><BR>and do the split work in your ASP code.<BR><BR>

Posting Permissions

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