I want to get to the parent location each time I'm adding a record. the problem is that i have a nested iframes, and each time the number of those is incremented:

eg.
at first adding record i have the location like this: parent.location
second: parent.parent.location
third: parent.parent.parent.location

how could i get to the initial location, without adding each time "parent."


Best regards,
zanzo

Recommended Answers

All 4 Replies

I would love an answer to this as well.....

Wel am not sure if this wil work.
First, try to add a <base> module with your preferred (x)html document.

<base target="_top" />

then try to incoporate the following bits of code in your script.

function someFunc() { 
//Storing location as array's and get the ref n#.

var thisLocation = [];
thisLocation.push(parent.location);

if (confirm('Whatever is true!','Test') == true) { alert(thisLocation[0].match(/\w\.[xhtml]{1}/)) }

Sorry i missed something on my first post.
It should be something like this

<script type="text/javascript">
function someFunc() { 
//Storing location as array's and get the ref n#.

//Try to run this demo

var thisLocation = [];
thisLocation.push(parent.location);

var loc = new String(thisLocation[0]);

if (confirm('Whatever is true!','Test') == true) { alert(loc.match(/\w+\.[html]{4}|\w+\.[xhtml]{5})) }
else { alert(loc); }
}
window.onload = someFunc;
</script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.