473,763 Members | 9,275 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing HTML Code of a frame

I wrote a javascript function which should return
the html code between a frame's body tag:

function load_frame_as_s tring( Framename )

{

var Frame = document.getEle mentsByName(Fra mename)[0];
var Frame_document = Frame.document;
var Frame_Body = Frame.document. getElementsByTa gName("body")[0];
var BodyCode = Frame_Body.inne rHTML;

alert(BodyCode) ;

return BodyCode;

}

Interestingly this function doesn't return the body element of the frame,
but the
body element of the parent window in which the frame is.
Also, if i insert Frame_document. location.href=" www.heise.de"
the location of my whole browser window changes, and not the
frame! What is happening here?

Thx in advance

Axel


Sep 25 '06 #1
3 1903

Can't say, unless there's more info on it like, the actual frameset
you're using or iframes if any, also be keen that there's no access
between different domains in frames.
Danny
Sep 26 '06 #2
Danny said the following on 9/26/2006 12:50 AM:
Can't say, unless there's more info on it like, the actual frameset
you're using or iframes if any, also be keen that there's no access
between different domains in frames.
Nothing you wrote is even remotely true. Had you bothered to read and
understand what was asked you would have known that.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Sep 26 '06 #3
Here is a more precise description of the problem:

This is my javascript function defined in "<head><scriptj avafunction
</script></head>"
section of my html "A" file , which resides on C://A.html
In that directory , there is also a html file "B" with a<body></body>
section in it
and a html file "C" with a<body></bodysection in it : C://B.html,
C://C.html

File A:
"<head><scr ipt>
function load_frame_as_s tring( Framename )

{

var Frame = document.getEle mentsByName(Fra mename)[0];
var Frame_document = Frame.document;

// trying to fetch Body HTML code of file B
var Frame_Body = Frame.document. getElementsByTa gName("body")[0];
var BodyCode = Frame_Body.inne rHTML;

// here the src gets changed from File B to C, and it works
Frame.src="C.ht ml";

alert(BodyCode) ;

return BodyCode;

}
</script</head>
<body>
<iframe width="100" height="100" src="B.html" name="loader1" >
</iframe>
<script type="text/javascript">
load_frame_as_s tring("loader1" )
<script>
</body>

As I said, I can't access the document object of my frame.
Whereas i can change the frame-src by Frame.src="C.ht ml",
i can't access it's Body.

Any Idea?

Thx
"Axel Gallus" <uh**@rz.uni-karlsruhe.desch rieb im Newsbeitrag
news:ef******** **@news2.rz.uni-karlsruhe.de...
>I wrote a javascript function which should return
the html code between a frame's body tag:

function load_frame_as_s tring( Framename )

{

var Frame = document.getEle mentsByName(Fra mename)[0];
var Frame_document = Frame.document;
var Frame_Body = Frame.document. getElementsByTa gName("body")[0];
var BodyCode = Frame_Body.inne rHTML;

alert(BodyCode) ;

return BodyCode;

}

Interestingly this function doesn't return the body element of the frame,
but the
body element of the parent window in which the frame is.
Also, if i insert Frame_document. location.href=" www.heise.de"
the location of my whole browser window changes, and not the
frame! What is happening here?

Thx in advance

Axel


Sep 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6664
by: Chris New | last post by:
G'Day All I am having trouble dynamically assigning a value to a table's cell from one frame to another frame. I've created a website that is primarily viewed in a frameset consisting of 2 frames - a navigation frame (navFrame) at the top and a contents frame (mainFrame) on the bottom. In all instances, the mainFrame displays a single page except in one case, where it was necessary to use a frameset consisting of a left frame...
2
8457
by: Halldór Ísak Gylfason | last post by:
Hello basically I have an IFrame inside the top frame. The document in IFrame defines a javascript object: var a = new Table(); in the top level frame I want to access this object. I tried doing document.getElementById("IFrameId").document.a
8
1913
by: Frédéric Mayot | last post by:
Hi, I have an HTML page like this : --- test.html <html> <body> <form> <iframe id="frametest" name="frametest" src="iframe.html"></iframe> <select multiple ondblclick="alert(frametest.v);"></select>
2
2014
by: TS | last post by:
In these 2 snippets, "user" references 2 different things in my app: ------------------------------------------------- Dim ident As System.Security.Principal.WindowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent() Dim User As New System.Security.Principal.WindowsPrincipal(ident) & HttpContext.Current.User -------------------------------------------------
5
1130
by: SalamElias | last post by:
Hi, I have an aspx page with some asp:textboxes. In Page_load, I can populate the textboxes, I have a button on the page, clicking the button generates the btton_click event. My proble is I am not able to access the values as textbox.text in this event. I am detting nothing as if I can not see those textbox objects. I can have the text in thme by using request.params("mytextbox") Tha&nks for your help
5
2307
by: J. Moreno | last post by:
Hi, I'm looking at some old code, and am having a problem with IE having changed how accesses an object: pages = window.parent.frames.item(1).document.all("position"); This works under Win200 and 6.0.2800.1106. But not under WinXp and 6.0.2900.2180.
1
1526
by: deece | last post by:
HI There! I hope someone can help me with this as I have been searching for about 2 weeks now for an answer and I have to admit that I am a designer and not much of a coder so all help would be greatly appreciated!! I have a website for a client www.respectmusic.com.au/welcome.html. At the moment it is divided into two frames and the top frame has a wimpy.swf music player. The reason for this is that my client wants the player to always be...
1
1946
by: sayid | last post by:
Hello, I have a problem when altering a DIV-element from another frame. The frameset looks like this: <frameset rows=0,0,* border=0> <frame name=header src=/header.htm scrolling=no noresize="true" frameborder=0> <frame name=border src=/border.htm scrolling=no noresize="true" frameborder=0> <frameset cols=200,* border=0> <frameset rows=*,0 border=0>
4
3748
by: maminx | last post by:
Hello..i have problem, hope someone can help me..i have this frameset below : <FRAMESET ROWS="55%" COLS="37%,63%"> <FRAME NAME="runningTrade" SRC="http://runningtrade.com" scrolling="no"> <FRAMESET ROWS="33%" COLS="51%,49%"> <FRAMESET ROWS="34%,34%,35%" cols="*"> <FRAME NAME="orderBook" SRC="http://od.com" scrolling="no"> <FRAME NAME="orderBook2" SRC="http://od2.com" scrolling="no"> <FRAME NAME="OrderBook3" SRC=""...
0
9564
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10002
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9823
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.