View Full Version : assume that dalia[i].email is known

11-01-2006, 09:00 PM
"<a href='dalia[i].email'>'dalia[i].email'</a>"

whats wrong with the sentence
basically, i want to have a working clicking link to dalia[i].email come out to be whatever email is at instance i in array dalia

11-04-2006, 07:09 AM
There is almost nothing wrong with it as a string variable, assuming as you say that dalia[i].email is known. It should however be expressed with + signs in the appropriate places to distinguish between quoted literals and quoted variables. Also, just for clarity's sake, the delimiter for the string should be the single quote (') freeing up the double quote(") for use as a literal in the string. Like so:

'<a href="'+dalia[i].email+'">'+dalia[i].email+'</a>'

If your object is to generate a mailto: link, then include that:

'<a href="mailto:'+dalia[i].email+'">'+dalia[i].email+'</a>'

For it to appear on a page though. It needs to be written to the page as it is loading using document.write() or similar or be inserted into the page after it has loaded using an element's innerHTML object. It could simply be assigned as a variable for later use. It could also be appended to the page using the DOM but, not directly from its value as a string.