Forum Moderators: open

Message Too Old, No Replies

iFrame help - stop links from opening in a new page

         

wirral

6:34 pm on May 26, 2008 (gmt 0)

10+ Year Member



Basically I've inserted an iFrame into a webpage, and the external webpage is an ASP file.

But when I select a link within the iFrame (using the ASP file) instead of loading a new page within the iFrame (which is what I want), it just opens up as a new page (leaving the one with the iFrame).

Does anyone know how I can solve this?

Trace

6:59 pm on May 26, 2008 (gmt 0)

10+ Year Member



The links in the framed page probably contain a target. Only way to fix this is to remove the that attribute. If you have no control over the framed page then there's nothing you can do.

wirral

7:03 pm on May 26, 2008 (gmt 0)

10+ Year Member



I've finally managed to get access to the files via FTP, but it's hard to find any target attributes as the links are drop down boxes, that access a database for the information.

So for example the drop down box has a list of football teams, and depending which one you select the list of players for that team comes up.

Any ideas?

Trace

8:16 pm on May 26, 2008 (gmt 0)

10+ Year Member



Yeah, when the choice is made an event is triggered, probably looks something like this;

<select id="dropdownid" onchange="dothis(this);">

That's calling a javascript function which in turn has something that resembles this;

window.open('list-of-players.html');

You'll need to modify that line so it looks like this;

document.location.href='listof-players.html';

Hope that helps.

wirral

11:18 am on May 27, 2008 (gmt 0)

10+ Year Member



Can I post the link so people can see the page in question or is that not allowed?

wirral

11:47 am on May 27, 2008 (gmt 0)

10+ Year Member



I have posted the code below if that helps:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Bold Street Car Breakers north west :: car details</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
-->
</style>
<!-- InstanceEndEditable -->
<link href="default.css" rel="stylesheet" type="text/css">
</head>

<td width="613" valign="top"><!-- InstanceBeginEditable name="body" -->
<table width="100%" border="0" cellspacing="5" cellpadding="5">
<tr>
<td height="147" colspan="2" valign="top" class="bodytext"> <table width="97%" height="132" border="0">
<tr>
<th width="28%" height="128" bgcolor="#000099" scope="row"><img src="full%20logo%20copy.gif" width="216" height="144"></th>
<td width="53%" bgcolor="#FFFF33">
<table width="99%" border="0">

<tr>
<th colspan="2" scope="row"><div align="center" class="style2"><font color="#000000">Thousands
of car parts off the shelf for all makes of car <br>
AT UNBEATABLE PRICES </font></div></th>
</tr>
<tr>
<th width="40%" scope="row"> <div align="right" class="style1"><font color="#A9A9A9"><font color="#000000"></font></font></div></th>
<th width="60%" scope="row"> <div align="right"><font color="#000000" size="4"><span class="style1">Tel
No: 0151 420 4166/2771</span></font></div></th>

</tr>
<tr>
<th height="21" colspan="2" scope="row"><div align="right" class="style1"><font color="#000000" size="4">Mobile:
07929 642994</font></div></th>
</tr>
<tr>
<th height="21" scope="row"><div align="right"><font color="#000000"><img src="creditcards.gif" width="143" height="13">
</font></div></th>
<th height="21" scope="row"><div align="right"><font color="#000000" size="4">Fax
No: 0151 420 2869</font></div></th>
</tr>

</table>
</td>
<td width="19%" bgcolor="#000099"><div align="center"><img src="CarImages/Bold%20Street%20multi%20pics%20001.jpg" width="138" height="111"></div></td>
</tr>
</table>
</td>
</tr>
<tr>
<tr>

<td>
</div>
<div id="menu" style="background-color: #FFFFFF">
<ul>
<ul>
<ul>
<table width="200" height="96" border="0">
<tr>
<td>
<div align="right">
<ul>

<li>
<div align="left"><font color="#ff0000"><a href="index2.htm">Home</a></font>&nbsp;</div>
</li>
<li>
<div align="left"><font color="#FF0000"><a href="carlist.asp">Cars&nbsp;</a></font></div>
</li>
<li>
<div align="left"><font color="#FF0000"><a href="lgv.htm">LGV+4X4</a>&nbsp;</font></div>
</li>

<li>
<div align="left"><font color="#FF0000"><a href="request.htm">Request Parts&nbsp;</a></font></div>
</li>
<li>
<div align="left"><font color="#FF0000"><a href="contact.htm">Contact Us</a></font></div>
</li>
</ul>
</div>
</td>

</tr>
</table>
<table width="84%" height="185" border="0">
<tr bordercolor="#FFFFFF">
<td><p align="center" class="style1 style6"><font size="4"><strong><font color="#000000">Vehicles
bought for cash</font></strong></font></p></td>
</tr>
<tr bordercolor="#FFFFFF">
<td><div align="center"><font color="#000000" size="4"><span class="style5"><strong>Top
prices paid</strong></span></font></div></td>
</tr>

<tr bordercolor="#FFFFFF">
<td><div align="center"></div></td>
</tr>
<tr bordercolor="#FFFFFF">
<td><div align="center"><font color="#000000" size="2"><span class="style5"><strong>Accident
Damaged</strong></span></font></div></td>
</tr>
<tr bordercolor="#FFFFFF">
<td><div align="center"><font color="#000000" size="2"><span class="style5"><strong>MOT
failures </strong></span></font></div></td>
</tr>

<tr bordercolor="#FFFFFF">
<td><div align="center"><font color="#000000" size="2"><span class="style5"><strong>Scrap
Vandalised</strong></span></font></div></td>
</tr>
<tr bordercolor="#FFFFFF">
<td><div align="center"><font color="#000000" size="2"><span class="style5"><strong>Fleet
Disposals</strong></span></font></div></td>
</tr>
<tr bordercolor="#FFFFFF">
<td><div align="center"><font color="#000000" size="2"><span class="style5"><strong>Part
Ex's </strong></span></font></div></td>
</tr>

<tr bordercolor="#FFFFFF">
<td height="24"> <div align="center"><font color="#000000" size="2"><span class="style5"><strong>High
Mileage </strong></span></font></div></td>
</tr>
<tr bordercolor="#FFFFFF">
<td height="21"><div align="center"><font color="#000000" size="2"><span class="style5"><strong>Anything
Bought</strong> </span></font></div></td>
</tr>
<tr>
<td height="21">&nbsp;</td>

</tr>
</table>
<p>&nbsp;</p></td>
<td valign="top"><p>&nbsp;</p><table width="34%" border="1" cellpadding="3" cellspacing="0" bordercolor="#000099">
<tr>
<td height="32" bgcolor="#000099"> <div align="center" class="style2"><font color="#FF0000">Currently
Breaking</font></div></td>
</tr>
<tr>

<td width="100%" valign="top" bgcolor="#CCCCCC"><form name="form1">
<div align="center">
<select name="menu1" class="bodytext" onChange="MM_jumpMenu('parent',this,0)">
<option selected value="">select a make</option>

<option value="carlist.asp?makecode=#*$!">ALFA ROMEO</option>

<option value="carlist.asp?makecode=aud">AUDI</option>

<option value="carlist.asp?makecode=bmw">BMW</option>

<option value="carlist.asp?makecode=chr">CHRYSLER</option>


<option value="carlist.asp?makecode=cit">CITROEN</option>

<option value="carlist.asp?makecode=dae">DAEWOO</option>

<option value="carlist.asp?makecode=dai">DAIHATSU</option>

<option value="carlist.asp?makecode=fia">FIAT</option>

<option value="carlist.asp?makecode=for">FORD</option>

<option value="carlist.asp?makecode=hon">HONDA</option>


<option value="carlist.asp?makecode=hyu">HYUNDAI</option>

<option value="carlist.asp?makecode=#*$!">LANDROVER</option>

<option value="carlist.asp?makecode=ldv">LDV</option>

<option value="carlist.asp?makecode=LEX">LEXUS</option>

<option value="carlist.asp?makecode=maz">MAZDA</option>

<option value="carlist.asp?makecode=mer">MERCEDES</option>


<option value="carlist.asp?makecode=mit">MITSUBISHI</option>

<option value="carlist.asp?makecode=niss">NISSAN</option>

<option value="carlist.asp?makecode=peu">PEUGEOT</option>

<option value="carlist.asp?makecode=pro">PROTON</option>

<option value="carlist.asp?makecode=ren">RENAULT</option>

<option value="carlist.asp?makecode=rov">ROVER</option>


<option value="carlist.asp?makecode=#*$!">SAAB</option>

<option value="carlist.asp?makecode=sea">SEAT</option>

<option value="carlist.asp?makecode=sko">SKODA</option>

<option value="carlist.asp?makecode=suz">SUZUKI</option>

<option value="carlist.asp?makecode=toy">TOYOTA</option>

<option value="carlist.asp?makecode=vau">VAUXHALL</option>


<option value="carlist.asp?makecode=volk">VOLKSWAGON</option>

<option value="carlist.asp?makecode=vol">VOLVO</option>

<option value="carlist.asp?makecode=jag">xj6</option>

</select>
</div>
</form></td>
</tr>

</table>
<p><span class="style2"><font color="#000000">Car List Page::</font></span>
<font color="#000000"><br>
<br>
We are dismantling most makes and models from 1995 - 2006. If we do
not have the part you require we will point you int he right direction.</font></p>
<p><font color="#000000">Give us a ring, we're only a phone call away.</font></p>
<table width="595" border="1" cellpadding="5" cellspacing="0" bordercolor="#000099">
<tr bgcolor="#000099" class="bodytext">
<td width="142" height="27"> <div align="center"><font color="#FF0000">Make</font></div></td>

<td width="151"> <div align="center"><font color="#FF0000">Model</font></div></td>
<td width="85"> <div align="center"><font color="#FF0000">Year</font></div></td>
<td width="167"> <div align="center"><font color="#FF0000">Other info
</font></div></td>
</tr>

</table>
<p>&nbsp;</p></td>

</tr>
<tr>
<td width="24%" height="382" valign="top">
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p></td>
<td width="76%" valign="top">
<p>&nbsp;</p>
<p>&nbsp;</p></td>
</tr>

</table>
<!-- InstanceEndEditable --></td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>

rocknbil

2:38 am on May 28, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If it's that car list select, here it is. Note the bold.

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
....

<select name="menu1" class="bodytext" onChange="MM_jumpMenu('parent',this,0)">
<option selected value="">select a make</option>

........

Change "parent" to "document,"

<select name="menu1" class="bodytext" onChange="MM_jumpMenu('document',this,0)">

Because of the way DW constructs it's "actions," you can't just leave it blank. document.location will keep it in the current frame.

<rant>
The previous post is a perfect example of why D.W. "actions" grate me so! Script language, abuse of eval, <!-- and //-->, ARGH! :-)
</rant>

wirral

10:50 am on May 28, 2008 (gmt 0)

10+ Year Member



Thanks for that, it works now :)

And apologies for the stupid code post, I only read the forum rules on code posting after I made the post :(

rocknbil

4:28 pm on May 28, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No problem with your post - it's what D.W. outputs that is bothersome. :-) The code was very helpful.