473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to iterate through an array returned from a javascript function in an HTML body

1
Hi,

I have a javascript function that returns an array of strings. For example, pretend I have 5 objects inserted into Array a:
Expand|Select|Wrap|Line Numbers
  1. function myfunction{
  2.   .
  3.   var a = new Array();
  4.   .....
  5.   return a;
  6. }
In my HTML body, I want to output the strings in the array into a table row. Only thing is I'm not sure where to begin, since I don't know how to mix javascript with HTML.
Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <HEAD></HEAD>
  3. <BODY>
  4.    <TABLE>
  5.       for(int i=0; i<myfunction().length;i++){
  6.            <TR>
  7.               myfunction()[i];
  8.            </TR>
  9.       }
  10.     </TABLE>
  11. </BODY>
  12. </HTML>
Please help. Thank you.
Jul 24 '07 #1
1 1296
pbmods
5,821 Expert 4TB
Heya, NY80. Welcome to TSDN!

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

document.write() will be your friend here.
Jul 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Obscurr | last post by:
i've got an array created in php that I want to send over to a javascript function. onclick = "return sjekk(<?echo $names; ?> )" in my "sjekk" function, when I try to print an alert : ...
2
by: Patrice | last post by:
HI, 1- I fill an array (arrayName ) of records (news and news titles) from an ACCESS database. 2- I call a function (loopDatasNews()) to build a table of news titles. 3- I call javascript...
2
by: CES | last post by:
All, Sorry for the 101 question but I can't figure out how to return all of the contents of an array to another function. I been able to figure out how to return individual elements of the array...
5
by: elsenraat_76 | last post by:
Hello! I was wondering if someone could help me out with a problem I'm having? I'm trying to input a javascript value into an anchor tag (from a function), but don't have an event to call the...
104
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from...
1
by: RuthC | last post by:
I am trying to pass a smarty array to a javascript function what is he easiest way to pass the values? I tried these code but not working. Please help me where i am wrong. <?php $url_names =...
3
realin
by: realin | last post by:
Hiya all, i am in deep trouble, i thought it was an easy task, but now its getting on my nerves. Well i have a div on a form, which contains a number of checkboxes, as <div...
3
by: manojrana | last post by:
I am using php code in a separately file and html code in as separate file , an array is passed from php to smarty, and then passing that array from smarty to javascript, I am getting it as...
4
by: rupalee | last post by:
if($uploadval==0) { $url = 'diacomviewer.php'; print '<a style="cursor:pointer ;font-size:11px; font-weight:lighter; font-family:Arial;" onclick="popitup(\'' .$url....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.