Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Javascript var assignments
Message
De
25/02/2005 09:12:54
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00989943
Message ID:
00990502
Vues:
24
I'm not sure what you mean by "init" functions, but here are a few JS tips:

1. JS is entirely case-sensitive with respect to vars *and* function names.
2. JS statements in most cases must terminate with semi-colons.
3. Whatever you have posted below is incomplete and/or makes no sense (transition from 2nd to 3rd line).
4. Variables declared in a function are local to that function. Outside your function theUrl, for example, does not exist.
5. Where do you see "THEURL not found"? In VFP? In your browser?
6. An Alert() call does not need the quote marks.
7. Assuming you're using VFP 8/9, you can avoid "delimiter hel1" by wrapping JS in TEXT TO/ENDTEXT, rather than concatenating strings in code. Ex:
LOCAL lcJS
TEXT TO lcJS NOSHOW PRETEXT 3
function Radio_Click(theCourseId){
  var theUrl = "..." ;
  alert(theUrl) ;
  return theUrl; // presumably 
}
ENDTEXT
* Now if you embedded any VFP expressions above, transform them:
lcJS = TEXTMERGE(m.lcJS) && or you could include TEXTMERGE clause in TEXT TO above
>I am working throug a VFP ISAPI COM that responds to the browser with javascript.
>
>I hacked around an issue today useing the js "var" to assign varibles (in js) when the browser received the page.
>
>I [think] I made a correlation. the "var" pre-cast seems only to be effective in functions other than "init" functions designated by an "onload".
>
>Color me java green. Here is a snip (forgive the delimeters code is from VFP COM(:
>[function Radio_Click(theCourseId){]+CR+;
>[var theUrl="HTTP://Somehost/scripts/foxISAPI.dll/MyCOM.myClass.myMethod?pwd="thePwd]+CR+;
>[alert("]+theUrl+[")]
>THe above returns the url. But, when I do it inside an init called by a js "onload", I get a "THEURL" (note all upper case) Not found. In fact, the var assigment in an onload will not recognize any var (or so it seems) assignmens. I have not tried with "new string" casts.
>
>I solved it by assembling the "var" in VFP above before the script response. Is "var" restricted in a js onload call?
>
>I must confess that I also spent several hours chasing down one problem when all I needed to do was assure I had the case of the variable names agree.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform