Forum Moderators: mack
¦=============¦
¦ ¦
¦ ¦
¦ ¦
¦ ¦
¦ ¦
¦=============¦
"send to a friend" prev 1¦2¦3¦ next
for 'send to a friend' in the iframe, i will need to access the contents of the iframe from the outer shell
something like parent.frames['i1'].getElementById('divname').innerHTML (not sure!)
i will have to wrap the inner content in divs or spans so they will be able to be accessed by the above string (or something like it)
So, the question is: can I get that data from the iframe and ready to be used in the shell?
The Javascript that I use to paginate through the sources of the iframe is as follows:
<script language="JavaScript" TYPE="text/javascript"><!--
var nextnum = 1;
if (nextnum == "") {nextnum = 1;}
function initPagination(pagenum, pagecount) {
if (pagecount <= 10) {
name = "cgp"+pagenum;
a = document.getElementById(name);
a.setAttribute("className", "navbar");
} else {
document.getElementById('number_span').innerHTML = pagenum;
}
}
function setPage(n)
{
reload(1);
name = "cgp"+nextnum;
a = document.getElementById(name);
a.setAttribute("className", "navbar_off");
nextnum = n;
name = "cgp"+nextnum;
a = document.getElementById(name);
a.setAttribute("className", "navbar");
}
function getNext (pagecount){
reload(1);
if (pagecount <= 10) {
name = "cgp"+nextnum;
a = document.getElementById(name);
a.setAttribute("className", "navbar_off");
}
nextnum = (nextnum == 5)? 1 : nextnum+1;
iframeUrl = "/getgoodgarden/iframe/0,17584,465017_SNK,00.html";
var iframeUrl = iframeUrl.replace(/SNK/,nextnum);
frames['i1'].location.href = iframeUrl;
if (pagecount <= 10) {
name = "cgp"+nextnum;
a = document.getElementById(name);
a.setAttribute("className", "navbar");
} else {
document.getElementById('number_span').innerHTML = nextnum;
}
}
function getPrev (pagecount){
reload(1);
if (pagecount <= 10) {
name = "cgp"+nextnum;
a = document.getElementById(name);
a.setAttribute("className", "navbar_off");
}
nextnum = (nextnum == 1)? 5 : nextnum-1;
iframeUrl = "/getgoodgarden/iframe/0,17584,465017_SNK,00.html";
var iframeUrl = iframeUrl.replace(/SNK/,nextnum);
frames['i1'].location.href = iframeUrl;
if (pagecount <= 10) {
name = "cgp"+nextnum;
a = document.getElementById(name);
a.setAttribute("className", "navbar");
} else {
document.getElementById('number_span').innerHTML = nextnum;
}
}
if(document.all &&!document.getElementById) {
document.getElementById = function(id) {
return document.all[id];
}
}
function reload(_v)
{
if (_v==1)
{
document.all.i2.src=/adframe/0,17610,93171904,00.html';
}
}
function writePrint() {
var agent = navigator.userAgent.toLowerCase();
if (agent.lastIndexOf('mac') < 0) {
document.write('<a href=javascript:printFrame("i1");><IMG src="/images/nav_button_print.gif" width=56 height=24 border=0 alt="print this"></a>');
}
}
function printFrame (f) {
eval("parent."+f+".focus()");
eval("parent."+f+".print()");
}
//-->
</script><SCRIPT LANGUAGE="JavaScript1.1" SRC="../file/adsWrapper.js" TYPE="text/javascript"></SCRIPT>
<script language="JavaScript" TYPE="text/javascript"><!--
var agent = navigator.userAgent.toLowerCase();
var is_gecko = agent.indexOf("gecko")!= -1;
function init() {
var myW = 749;
var myHsh = document.body.scrollHeight + 4;
var myH = screen.availHeight-window.screenTop-36;
if (myHsh < myH) myH = myHsh;
self.resizeTo(myW,myH);
adjW = ((screen.width - myW) / 2);
window.moveTo(adjW);
}
function modLinks() {
var link, l = 0;
while (link = document.links[l++]) {
if (link.href.indexOf('.......com') == -1 && link.href.indexOf('javascript:') == -1 && link.target.indexOf('i1') == -1 && link.href.indexOf('aol://5863') == -1 && link.href.indexOf(........com') == -1) link.target = '_blank';
}
}
start = agent.indexOf("aol") + 3;
end = agent.indexOf(";",start);
aol_str = agent.substring(start,end);
aol_vers = parseInt(aol_str);
if (aol_vers > 6) {
//this.onload = modLinks
this.onload = init
}
//-->
</script>
So, the question is: can I get that data from the iframe and ready to be used in the shell?
parent.frames['i1'].getElementById('divname').innerHTML
window.frames['i1'].document.getElementById('divname').innerHTML;
(I added 'document', and I changed 'parent' to 'window' b/c your sendToFriend link is already in the shell, not the inner frame, correct?
Also, this post is off the top of my head-- I'm only assuming your code doesn't work and your question is why not...! :)
var emailBody;
var emailTo;
var emailSubject;
var emailCC;
var emailBCC;
var emailURL;
emailTo = ""
emailBody = (window.frames['i1'].document.getElementById('framedata').innerHTML)
emailSubject = ""
emailCC = ""
emailBCC = ""
emailReplyTo = ""
emailURL = "mailto:" + escape(emailTo) +
"?subject=" + escape(emailSubject) +
"&cc=" + escape(emailCC) +
"&bcc=" + escape(emailBCC) +
"&replyto=" + escape(emailReplyTo) +
"&body=" + escape(emailBody);
window.location = emailURL;
return true;
}
</script>
It sends the code of the HTML like the tags, <> ... </...>. I tried InnerText, but only the text gets emailed. I would need to send the whole entire HTML, with the picture from the iframe - whatever's there.
Thanks.
I would need to send the whole entire HTML, with the picture from the iframe - whatever's there.
See one in action: step through the execution, using MS Script Debugger, of composing a Hotmail message with "Rich Editor" on and inserting an image. I know you can even copy/paste an image in, if it's accessible on the web somewhere, and the result is an img and urn.
Please do keep this thread posted with your progress/results.
alert(document.frames['contentIF'].document.documentElement.outerHTML)
it works but i get an error as well....
any help?