|
|
 |
Re: FN-FORUM Dynamically creating links from arrays
date posted 18th April 2001 15:20
Thanks Dave Ecky and Ruth,
I solved the problem with the following:
WriteLinksScript
var arr1= Array("aa.html","ab.html","ac.html","ad.html","ae.html");
var arr2= Array("linkNameA","linkNameB","linkNameC","linkNameD","linkNameE");
function writeLinks() {
for (i=0;ipeter,
>
>instead of 2 arrays couldnt you use an array of objects?
>
>function linx(url, txt){
>
>//contructor for linx object
> this.url=url;
> this.txt=txt;
>
>}
>
>arrLinx=new Array
>
>//create array of linx objects
>
>arrLinx[0]=new linx('www.site1.com', 'site1')
>arrLinx[1]=new linx('www.site2.com', 'site2')
>.........
>
>function writeout(){
>
>//display array of objects/properties
>
> for (a=0;a document.write ("href='"+arrLinx[a].url+"'>"+arrLinx[a].txt+"");
>
>}
>
>been a while since i programmed javascript in this manner so it may need
>some bashing around but the basic idea should work.
>
>a better way would be using a db and outputting server side of course.
>
>hth
>
>dave ecky
>
>David Eckersall
>Kinetic North Limited
>A member of the Wize Group of companies
>Reg Co No 4100142
>Reg Office and Business Address
>St James House, Wellington Road North
>Stockport SK4 2QN
>Office Tel - 00 44 161 975 5900
>Office Fax - 00 44 161 975 5924
>Web - http://www.kineticnorth.com
>
>This communication contains information which is confidential and may also
>be privileged. It is for the exclusive use of the intended recipient(s). If
>you are not the intended recipient(s) please note that any form of
>distribution, copying or use of this communication or the information in it
>is strictly prohibited and may be unlawful. If you have received this
>communication in error please return it to the sender. Internet e-mails are
>not necessarily secure. Kinetic North Limited does not accept responsibility
>for changes made to this message after it was sent. Our messages are checked
>for viruses but please note that we do not accept liability for any viruses
>which may be transmitted in or with this message.
>
>----- Original Message -----
>From: "Peter Small" [EMAIL REMOVED]
>To: [EMAIL REMOVED]
>Sent: Wednesday, April 18, 2001 7:34 AM
>Subject: FN-FORUM Dynamically creating links from arrays
>
>
>> I have two arrays. One array is a list of text strings, the other
>> array is a list of URLs.
>>
>> I need to dynamically create a page of links from these two arrays
>> when the page is downloaded to the browser.
>>
>> I'm sure it can be done in JavaScript as David Flanagan's O'reilly
>> Javascript book shows (section 14.6 Links), but I'm having problems
>> getting it working.
>>
>> Anyone had any experience with this kind of situation?
>>
>> peter
>> www.petersmall.net
>>
>>
>>
>> ============================================================
>>
>> * Free listing for freelancers
>> * Free to advertise jobs
>> * Free jobs distribution service
>> * Free database of 1000 freelancers
>>
>> Freelancers and Freelance Jobs
> > http://www.freelancers.net
> >
> > To post to the Forum:
> > [EMAIL REMOVED]
> >
> > To unsubscribe please email:
> > [EMAIL REMOVED]
>>
>> If you have difficulties unsubscribing please email:
>> [EMAIL REMOVED]
>>
>> To subscribe to the digest for this list or for further information please
>visit:
>> http://www.freelancers.net/forum.html
>
>
>
>============================================================
>
> * Free listing for freelancers
> * Free to advertise jobs
> * Free jobs distribution service
> * Free database of 1000 freelancers
>
>Freelancers and Freelance Jobs
>http://www.freelancers.net
>
>To post to the Forum:
[EMAIL REMOVED]
>
>To unsubscribe please email:
[EMAIL REMOVED]
>
>If you have difficulties unsubscribing please email:
[EMAIL REMOVED]
>
>To subscribe to the digest for this list or for further information
>please visit:
>http://www.freelancers.net/forum.html
|
 |
|