Gotta be the newbie question of all time. I am trying to change an image and its text description located in an HTML file inside one iFrame from a function in another iFrame. I can change the image with the following line in the function:
parent.frames[‘[I]framename[/I]’].document.images[‘[I]imagename[/I]’].src = [I]imagefilename[/I]
But I can’t figure out how to change the text of an anchor. I have tried something like:
parent.frames[‘[I]framename[/I]’].document.anchors[‘[I]anchorname[/I]’].text = [I]string[/I]
Searching the web for syntax, it seems that anchortext is read-only, so maybe I should be using something other than an anchor to display the string I want. Any ideas?
function loadImage(imageURL,anchorText) {
if (gImageCapableBrowser) {
parent.frames['closeups'].document.images['4hSlide'].src = imageURL
parent.frames['closeups'].document.[color=blue]getElementById('4hComment').innerHTML[/color] = anchorText
return false;
}
else {
return true;
}
}
<!-- This is on the other frame -->
<div align="left">
<A CLASS="name" [color=blue][b]id[/b]="4hComment"[/color]>Ferdinand, the Pride of Pacifica 4H</A>
<IMG CLASS="image" SRC="ferdinand%2001.jpg" id="4hSlide" WIDTH="640" HEIGHT="480">
</DIV>
The comments are read in from a text file[/QUOTE]Is this using JSP? PHP? With PHP you use:
$comments = addslashes($comments);
But I can't figure out how to change the text of an anchor. I have tried something like:
parent.frames['[I]framename[/I]'].document.anchors['[I]anchorname[/I]'].text = [I]string[/I][/QUOTE]
Don't use the NAME attribute on a link -- unless it is an anchor (bookmark), only. For a true hyperlink, use an ID:
parent.frames['framename'].document.getElementById('linkID').innerHTML = string
Thanks again phpnovice. I did get that help somewhere up that thread.[/QUOTE]
Except when someone wants to put quotes or apostrophies in the photo comment. Those special symbols end the string early.[/QUOTE]
0.1.9 — BETA 5.30