• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 542
  • Last Modified:

Using Iframe and display Javascript HTML

Hi - thanks for looking at my question.

I am using an Iframe in my ASP page that contains several SELECT boxes.  The problem is that the Select boxes only show inside  the IFRAME.

Is there a way,  of making the contents of an iframe overlap into the page that it shows in?

Any ideas?
0
Pigdogmonster
Asked:
Pigdogmonster
1 Solution
 
rlbalanCommented:
I doubt if this can be achieved. The containing page and the IFRAME are two different documents. If you want part of the data in the IFRAME and the rest in the including page, I think u need to programatically split your content and write in both places.

You might want to rethink why you needed IFRAME in the first place.

0
 
hujiCommented:
I also think it is not possible. However, you may call the parent window of IFRAME and add a DIV there, which contains a select, and place this DIV where you want. Just my 2 cents....
0
 
PigdogmonsterAuthor Commented:
Hi Gents,

Sorry for the delay in responding - thanks for your comments.
I do however have a 2nd part to this question and I'm not sure if this is possible either..

I have my main page that has 2 Iframes in it..

<html>
IFRAME NUMBER 1
<iframe name="Number1" src="Page2.htm" >
</iframe>

IFRAME NUMBER 2
<iframe name="Number2" src="Page3.htm" >
</iframe>
</html>

My question is... Can I reference an iframe as a TARGET from a hyperlink from inside Page2.htm or Page3.htm
So that if the user clicks a link in Frame 1 it opens the link in Frame 2?

i.e : This would be the contents of Iframe Number 2  <a href="http://www.google.co.uk" TARGET="Number1">Click HERE</a>

Is this possible or have I explained it completely wrong?

Thanks

PDM
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
rlbalanCommented:
This is possible.  You can use something like this
<a href="http://www.google.co.uk" onClick="loadIframe()">Click HERE</a>

where loadFrame is a JS function

function loadframe() {
   parent.Number1.location.href=iframe1URL ;
  return;
}
0
 
hujiCommented:
0
 
hujiCommented:
Sorry, I meant "you can". The link I gave you shows how to name the frames.

Read this too: http://www.htmlcodetutorial.com/linking/_A_TARGET.html
0
 
ZvonkoSystems architectCommented:
Here again the "AJAX" version:

<html>
<head>
<title>Zvonko &#42;</title>
<script>
function GOANDGETDATA(theSel){
  if(theSel.options.length>0) return;
  var newReq = document.createElement("iframe");
  newReq.style.display="none";
  document.body.appendChild(newReq);
  newReq.name = "req"+theSel.name;
  newReq.src = "getData.asp?select="+theSel.name;
}
function loadSelect(theSelName){
  var opt = document.forms[0][theSelName].options;
  opt.length = 0;
  var selOpt = self["req_"+theSelName];
  for(var i=0;i<selOpt.length;i++){
    opt[i] = new Option(selOpt[i].text,selOpt[i].value);
  }
}
</script>
</head>
<body>
<form>
<select name="mySelectOne" onfocus="GOANDGETDATA(this)" >
</select>
<select name="mySelectTwo" onfocus="GOANDGETDATA(this)" >
</select>
<select name="mySelectThree" onfocus="GOANDGETDATA(this)" >
</select>
</form>
</body>
</html>


getData.asp:

<%

  Response.Write("<script>")
  Response.Write("parent.req_" & Request.QueryString("select") & " = [")
  For i=1 To 12
    if i > 1 Then response.Write(",")
    Response.Write("{text: 'Option" & i & "', value: 'v" & i & "' }")
  Next
  Response.Write("];" & Chr(13) )
  Response.Write("parent.loadSelect('" & Request.QueryString("select") & "');" )
  Response.Write("</script>")

%>
 

0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now