Current location: Hot Scripts Forums » General Web Coding » JavaScript » Macro substitution in JavaScript?


Macro substitution in JavaScript?

Reply
  #1 (permalink)  
Old 01-25-04, 07:37 AM
victorace victorace is offline
New Member
 
Join Date: Jan 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question Macro substitution in JavaScript?

Hi there!

I am a complete beginner in JavaScript. I am a Visual FoxPro programmer who is trying to set an existing application on the net.
My problem is that I cannot find a way to use macro substitutions with JavaScript. I have searched everywhere but found nothing 'til now.

Here is an example of what I am trying to do.
If other languages I can just do the following in order to calculate the totals for a given set of controls (assuming there is a form full of controls named TEXT1, TEXT2, TEXT3, etc.:

lnTotal = 0
FOR i = 5 TO 20
lcControl = 'Text' + STR(i)
lnTotal = lnTotal + VAL(Form.&lcControl..value)
NEXT

This way I can just get the total for controls 5 to 20.
Does anyone know what is the way to do the same in JavaScript? I mean, referencing a control by macro substitution(Form.&lcControl)???

I would greatly appreciate any help.

Thanks in advance!
Reply With Quote
  #2 (permalink)  
Old 02-05-04, 03:26 PM
roughraver532 roughraver532 is offline
New Member
 
Join Date: Feb 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Macro Substitution in JavaScript

What you could do it put your JavaScript code in between <div> tags:

<div id = "invisibleText" style= "position:absolute; top:270; left:10; z-index:2"> JavaScript goes here </div>

then your java code also in between <div> tags:

<div id = "invisibleText" style= "position:absolute; top:270; left:10; z-index:1"><applet name = "something.class"></applet>
</div>

The javaScript will be on top because it has a higher z-index (2)/
Good Luck!
Angie

Quote:
Originally Posted by victorace
Hi there!

I am a complete beginner in JavaScript. I am a Visual FoxPro programmer who is trying to set an existing application on the net.
My problem is that I cannot find a way to use macro substitutions with JavaScript. I have searched everywhere but found nothing 'til now.

Here is an example of what I am trying to do.
If other languages I can just do the following in order to calculate the totals for a given set of controls (assuming there is a form full of controls named TEXT1, TEXT2, TEXT3, etc.:

lnTotal = 0
FOR i = 5 TO 20
lcControl = 'Text' + STR(i)
lnTotal = lnTotal + VAL(Form.&lcControl..value)
NEXT

This way I can just get the total for controls 5 to 20.
Does anyone know what is the way to do the same in JavaScript? I mean, referencing a control by macro substitution(Form.&lcControl)???

I would greatly appreciate any help.

Thanks in advance!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript menu covered by java applet shaisachs JavaScript 7 12-28-04 11:38 PM
how many javascript popup windows.. epic1231 JavaScript 5 12-31-03 06:01 PM
Reaaly stuck about javascript over frames muratisik JavaScript 1 12-14-03 11:58 AM
php and javascript together? gamextremer2003 PHP 5 11-06-03 02:18 PM
Forcing a JavaScript to abort HiMyNameIs JavaScript 3 09-18-03 10:23 AM


All times are GMT -5. The time now is 01:54 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.