Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Targeting an iframe made within a script causes ie to open new page
Old 06-29-2010, 02:25 PM Targeting an iframe made within a script causes ie to open new page
Novice Talker

Posts: 5
Name: Chris
Trades: 0
So i have an iframe that populates based on different informational pages submitted by different offices. These pages are simple text in the frame. I used some code i found online to force people to use the iframe not to just view the informational pages. For some reason if i try to use the "target" command to change the content of the iframe it opens a new browser window with the information in it. I just wanted it to populate the iframe,

The js code for the iframe is this
Code:
<script type="text/javascript" language="javascript">
/* <![CDATA[ */
var curl = location.search.substring(1) ? unescape(location.search.substring(1)) : 'About_Us/About_Us.htm';
document.writeln('<iframe id="aboutus" src="'+curl+'" width="100%" height="425" frameborder="0">');
document.writeln('<p>This page doesn\'t support iframes. You can <a href="'+curl+'?nf" target="_blank">view the page in a separate window<\/a> instead.<\/p>');
document.writeln('<\/iframe>');
/* ]]> */
</script>
<noscript>
<iframe src="About_Us/About_Us.htm" width="100%" height="420" frameborder="0" >
<p>This page doesn't support iframes. You can <a href="About_Us/About_Us.htm" target="_blank">view the page in a separate window</a> instead.</p>
</iframe>
</noscript>
the js i use to lock the subpages is

Code:
<script type="text/javascript" language="javascript">
if (self.location == top.location &&
location.search.substring(1) != 'nf')
top.location.href = '../About_Us_Home.htm?' + escape(self.location); 
</script>
so when i use html to target a page I use

HTML Code:
<td>
        <a href="About_Us/Message_From_The_President.htm" target="aboutus" class="style117">
        <span class="style121">&nbsp;&nbsp;
Message From the President</span></a></td>
So what did I do wrong? Did I miss something? JS is not a language i realy understand so any help would be greatly appreciated.

Thanks
Chris
DKLD is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-29-2010, 02:33 PM Re: Targeting an iframe made within a script causes ie to open new page
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
The iframe requires a name attribute to use in the target attribute.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-29-2010, 03:02 PM Re: Targeting an iframe made within a script causes ie to open new page
Novice Talker

Posts: 5
Name: Chris
Trades: 0
I used "id" in stead of "name" to make it work in ff and ie. Do i need to add a name attribute to?
DKLD is offline
Reply With Quote
View Public Profile
 
Old 06-29-2010, 03:37 PM Re: Targeting an iframe made within a script causes ie to open new page
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Yes you do, it is the name attribute value that should be used for targetting.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-29-2010, 03:37 PM Re: Targeting an iframe made within a script causes ie to open new page
Novice Talker

Posts: 5
Name: Chris
Trades: 0
Thanks i see what you meant. Problem solved
DKLD is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Targeting an iframe made within a script causes ie to open new page
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.34398 seconds with 12 queries