Problem opening page in dynamically generated iframe

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Problem opening page in dynamically generated iframe
Malkalypse
CZ Newbie
Malkalypse has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Apr 17, 2005
0.00 posts per day
Posts: 4
Points: 80
   
Hello, I have been having some trouble with this one, so I decided to strip it down to its simplest form. I think I found the root of the problem, but I don't know how to solve it.

I need a link in one iframe to open a page in a different iframe. I can do this normally:

[ Register or login to view links on this board.]

But, when the iframes are dynamically generated (created via a javascript function), the target id does not seem to be recognized, and the content is opened in a new window:

[ Register or login to view links on this board.]

I need to get the second page working like the first one. Can anyone tell me what I'm doing wrong?



Back to top Reply with quote
#2   re: Problem opening page in dynamically generated iframe
GoddsEgo
PayPal Donation
CZ Moderator
Status: Offline
Joined: Jun 26, 2003
0.15 posts per day
Posts: 1211
Points: 69,166
 Yahoo Messenger  
Hi Malkalypse,

I am not a java guru but I THINK the problem is that the main window object and its properties are set when it loads. So creating new elements within it and appending attributes to such elements will not change the main widows view of its or any other windows properties that are nested within it unless you access the main directly and give it new instructions.

Once the iframes are created tell the main window model the name of the windows that are open within it.


<html>
<head>

<script language="javascript">
function buildAction() {

  var ActionFrame  = document.createElement("iframe");
  ActionFrame.id   = "Action";
  ActionFrame.name = "Action";
  ActionFrame.src  = "ActionPage.htm";
ActionFrame.target  = "Target";
  document.body.appendChild(ActionFrame);
}

function buildTarget() {

  var TargetFrame  = document.createElement("iframe");
  TargetFrame.id   = "Target";
  TargetFrame.name = "Target";
  TargetFrame.src  = "TargetPage.htm";
  document.body.appendChild(TargetFrame); 
}

function buildPage() {
buildAction();
buildTarget();
frames[0].name = "Action";
frames[1].name = "Target";
}
</script>

</head>
<body onload = buildPage();>
</body>
</html>



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum