View Full Version : JS Frames Query
jack73
12-06-2002, 04:01 PM
Can some help with my Frames query which I thought initially would be simple enough but have come to a dead end.
I want my link in the left navigation to open up a seperate frame which in HTML I use Target="useCont". When I can use this in js it has errored. Have I written this correctly? Many Thanks!
<td onmouseover="fadeImg2(9)" onmouseout="fadeImgend2(9)" onclick="window.top.useCont.location.href='http://www.intrawide.nbsnet.co.uk/livepub/secure/Finance/SID/Default.htm'"; style="border:1px solid gray;background-color:#000066;width:150;text-align:left"><font color="white" size="1">SID Newsletter (SID Employees Only)</td>
Jackie
Roy Sinclair
12-06-2002, 04:39 PM
Originally posted by jack73
Can some help with my Frames query which I thought initially would be simple enough but have come to a dead end.
I want my link in the left navigation to open up a seperate frame which in HTML I use Target="useCont". When I can use this in js it has errored. Have I written this correctly? Many Thanks!
<td onmouseover="fadeImg2(9)" onmouseout="fadeImgend2(9)" onclick="window.top.useCont.location.href='http://www.intrawide.nbsnet.co.uk/livepub/secure/Finance/SID/Default.htm'"; style="border:1px solid gray;background-color:#000066;width:150;text-align:left"><font color="white" size="1">SID Newsletter (SID Employees Only)</td>
Jackie
It looks like you wrote the onclick function correctly but you're missing the closing </font> tag which should be before the </td> tag or better yet remove the deprecated (that means it's obsolete so you should stop using it and learn how to use the better things which replace it) <font> tag by adding color:white;font-size:xx-small; to the style for the <td> element.
jack73
12-06-2002, 04:46 PM
I have closed the font tag as intsructed but i still does not seem to work. It appears its the "useCont" element that is erroring as if I replace it with "content" it replaces the main page. What are the other tags in js for targets or are they the same as in HTML?
Thanks for your help with the font coding too.
Roy Sinclair
12-06-2002, 04:53 PM
Your frame is named useCont right? Remember that the name is case sensitive too so it won't work if the frame is named UseCont.
jack73
12-06-2002, 04:58 PM
Yes I have just given the C upper case. I seem to be at abit of a loss now then.
Roy Sinclair
12-06-2002, 05:25 PM
Try: window.top.frames["useCont"].location.href
See if that works.
jack73
12-06-2002, 05:35 PM
Hi Ray
Tried that one and it doesnt open a frame but an error flag doesnt appear at the bottom of the page. It just says "done".
<td onmouseover="fadeImg2(9)" onmouseout="fadeImgend2(9)" onclick="window.top.frames["useCont"].location.href='http://www.intrawide.nbsnet.co.uk/livepub/secure/Finance/SID/Default.htm'"; style="border:1px solid gray;background-color:#000066;width:150;text-align:left"><font color="white" size="1">SID Newsletter (SID Employees Only)</font></td>
Jackie
Roy Sinclair
12-06-2002, 06:13 PM
Simple mistake:
<td onmouseover="fadeImg2(9)" onmouseout="fadeImgend2(9)" onclick="window.top.frames['useCont'].location.href='http://www.intrawide.nbsnet.co.uk/livepub/secure/Finance/SID/Default.htm'"; style="border:1px solid gray;background-color:#000066;width:150;text-align:left"><font color="white" size="1">SID Newsletter (SID Employees Only)</font></td>
Used the wrong quote marks which terminated the onclick string.
jack73
12-07-2002, 11:59 AM
Oh yeh I see that. Thanks! Corrected it and it is back to Error on page so I dont think it likes the 'useCont' element. I tried to replace it with 'self' and that work (it replaces the whole page). I am wondering if there is some coding which is stopping useCont from working.
I will paste the whole js that i used. Could you look if you have the time - thank you.
<BODY>
<table>
<tr>
<td>
</td></tr></table>
<style>
. tds
{
background-Color:silver;
width:100;
height:20;
text-align:center;
border:1px solid gray;
font-size:14;
filter:alpha(opacity=45);
-moz-opacity:45%;
cursor:crosshair;
}
</style>
<script language="javascript">
nOpac = 50
nPlus = 2
nMin = 1
speed = 30
timer = null;
timer2 = null;
var ie5=(document.all && document.getElementById);
var ns6=(!document.all && document.getElementById);
function fadeImg2(teller)
{
apl[teller][1] = "Up";
changes();
}
function fadeImgend2(teller)
{
apl[teller][1] = "Down";
setTimeout("changes()",50);
}
function changes()
{
next_loop = true;
for (i=0;i<apl.length;i++)
{
obj = link_table.rows[i].cells[0];
opacity = apl[i][0]
if (apl[i][1] == "Up")
{
opacity += nPlus;
apl[i][0] = opacity;
if (apl[i][0] > 105)
{apl[i][1] = "";}
else
{next_loop = false;}
nOpac = opacity;
}
else
{
if (apl[i][1] == "Down")
{
opacity -= nMin;
apl[i][0] = opacity;
if (apl[i][0] < 45)
{apl[i][1] = "";}
else
{next_loop = false;}
nOpac = opacity;
}
}
if(ie5){
obj.style.filter="alpha(opacity="+opacity+")";
}
if(ns6){
obj.style.MozOpacity = opacity + '%';
}
}
if (next_loop == false)
{
timer = setTimeout("changes()",speed);
}
else
{
clearTimeout(timer);
}
}
//for each link option you need to make a new Array;
var apl = new Array();
apl[0] = new Array(45,"");
apl[1] = new Array(45,"");
apl[2] = new Array(45,"");
apl[3] = new Array(45,"");
apl[4] = new Array(45,"");
apl[5] = new Array(45,"");
apl[6] = new Array(45,"");
apl[7] = new Array(45,"");
apl[8] = new Array(45,"");
apl[9] = new Array(45,"");
//expl: apl[9] = new Array(45,"");
</script>
<body>
<table >
<tr><td align=center border=2 target="main">
<table cellpadding=7 cellspacing=7 name=link_table id=link_table>
<tr>
<td class="tds" onmouseover="fadeImg2(0)" onmouseout="fadeImgend2(0)" onclick="window.top.content.location.href='home2.htm';" style="border:1px solid gray;background-color:#000066;width:150;text-align:left"><font color="white" size="1">Home</td>
</tr>
<tr>
<td class="tds" onmouseover="fadeImg2(1)" onmouseout="fadeImgend2(1)" onclick="window.top.content.location.href='sidpage.htm';" style="border:1px solid gray;background-color:#000066;width:150;text-align:left"><font color="white" size="1">SID Uncovered</td>
</tr>
<tr>
<td CLASS="tds" onmouseover="fadeImg2(2)" onmouseout="fadeImgend2(2)" onclick="window.top.content.location.href='hotissues.htm';" style="border:1px solid gray;background-color:#000066;width:150;text-align:left"><font color="white" size="1">Hot Issues-Fraud Prevention Alerts</td>
</tr>
<tr>
<td class="tds" onmouseover="fadeImg2(3)" onmouseout="fadeImgend2(3)" onclick="window.top.content.location.href='StaffFraud.htm';" style="border:1px solid gray;background-color:#000066;width:150;text-align:left"><font color="white" size="1">Employee Investigations Team</td>
</tr>
<tr>
<td class="tds" onmouseover="fadeImg2(4)" onmouseout="fadeImgend2(4)" onclick="window.top.content.location.href='Rewards.htm';" style="border:1px solid gray;background-color:#000066;width:150;text-align:left"><font color="white" size="1">Employee Rewards</td>
</tr>
<tr>
<td class="tds" onmouseover="fadeImg2(5)" onmouseout="fadeImgend2(5)" onclick="window.top.content.location.href='quiz1.htm'"; style="border:1px solid gray;background-color:#000066;width:150;text-align:left"><font color="white" size="1">Fraud Quiz</td>
</tr>
<tr>
<td class="tds" onmouseover="fadeImg2(6)" onmouseout="fadeImgend2(6)" onclick="window.top.content.location.href='http://www.intrawide.nbsnet.co.uk/livepub/non-secure/grpfin/auditsid/sidbull/default.htm'"; style="border:1px solid gray;background-color:#000066;width:150;text-align:left"><font color="white" size="1">Fraud Prevention Updates</td>
</tr>
<tr>
<td class="tds" onmouseover="fadeImg2(7)" onmouseout="fadeImgend2(7)" onclick="window.top.content.location.href='cifas.htm'"; style="border:1px solid gray;background-color:#000066;width:150;text-align:left"><font color="white" size="1">CIFAS</td>
</tr>
<tr>
<td class="tds" onmouseover="fadeImg2(8)" onmouseout="fadeImgend2(8)" onclick="window.top.content.location.href='FPI.htm'"; style="border:1px solid gray;background-color:#000066;width:150;text-align:left"><font color="white" size="1">Fraud Consultancy Team</td>
</tr>
<tr>
<td onmouseover="fadeImg2(9)" onmouseout="fadeImgend2(9)" onclick="window.top.usecont.location.href='http://www.intrawide.nbsnet.co.uk/livepub/secure/Finance/SID/Default.htm'"; style="border:1px solid gray;background-color:#000066;width:150;text-align:left"><font color="white" size="1">SID Newsletter (SID Employees Only)</font></td>
</tr>
</table>
</td></tr></table>
</script>
</body>
oliverg1
12-08-2002, 08:32 AM
Hi Guys! The essence of this is very similar to other posts on other sites... I am presuming that the frame is the problem... I would suggest ... delete erroneous code... try essence code... then repost problem... I had something similar to this...
Spaek to you soon!
jack73
12-09-2002, 01:15 PM
Hiya
Thanks for having at look at this for me.
I assume you mean change the HTML for JS ? I have dont this but the frame still doesnt open. Any ideas?
Jackie
//for each link option you need to make a new Array;
var apl = new Array();
apl[0] = new Array(45,"");
apl[1] = new Array(45,"");
apl[2] = new Array(45,"");
apl[3] = new Array(45,"");
apl[4] = new Array(45,"");
apl[5] = new Array(45,"");
apl[6] = new Array(45,"");
apl[7] = new Array(45,"");
apl[8] = new Array(45,"");
apl[9] = new Array(45,"");
//expl: apl[9] = new Array(45,"");
</script>
<body>
<table >
<tr><td align=center border=2 target="main">
<table cellpadding=7 cellspacing=7 name=link_table id=link_table>
<tr>
<td class="tds" onmouseover="fadeImg2(0)" onmouseout="fadeImgend2(0)" onclick="window.top.content.location.href='home2.htm';" style="border:1px solid gray;background-color:#000066;width:150;text-align:left;color:white;font-size:xx-small;">Home</td>
</tr>
<tr>
<td class="tds" onmouseover="fadeImg2(1)" onmouseout="fadeImgend2(1)" onclick="window.top.content.location.href='sidpage.htm';" style="border:1px solid gray;background-color:#000066;width:150;text-align:left;color:white;font-size:xx-small;">SID Uncovered</td>
</tr>
<tr>
<td CLASS="tds" onmouseover="fadeImg2(2)" onmouseout="fadeImgend2(2)" onclick="window.top.content.location.href='hotissues.htm';" style="border:1px solid gray;background-color:#000066;width:150;text-align:left;color:white;font-size:xx-small;">Hot Issues-Fraud Prevention Alerts</td>
</tr>
<tr>
<td class="tds" onmouseover="fadeImg2(3)" onmouseout="fadeImgend2(3)" onclick="window.top.content.location.href='StaffFraud.htm';" style="border:1px solid gray;background-color:#000066;width:150;text-align:left;color:white;font-size:xx-small;">Employee Investigations Team</td>
</tr>
<tr>
<td class="tds" onmouseover="fadeImg2(4)" onmouseout="fadeImgend2(4)" onclick="window.top.content.location.href='Rewards.htm';" style="border:1px solid gray;background-color:#000066;width:150;text-align:left;color:white;font-size:xx-small;">Employee Rewards</td>
</tr>
<tr>
<td class="tds" onmouseover="fadeImg2(5)" onmouseout="fadeImgend2(5)" onclick="window.top.content.location.href='quiz1.htm'"; style="border:1px solid gray;background-color:#000066;width:150;text-align:left;color:white;font-size:xx-small;">Fraud Quiz</td>
</tr>
<tr>
<td class="tds" onmouseover="fadeImg2(6)" onmouseout="fadeImgend2(6)" onclick="window.top.content.location.href='http://www.intrawide.nbsnet.co.uk/livepub/non-secure/grpfin/auditsid/sidbull/default.htm'"; style="border:1px solid gray;background-color:#000066;width:150;text-align:left;color:white;font-size:xx-small;">Fraud Prevention Updates</td>
</tr>
<tr>
<td class="tds" onmouseover="fadeImg2(7)" onmouseout="fadeImgend2(7)" onclick="window.top.content.location.href='cifas.htm'"; style="border:1px solid gray;background-color:#000066;width:150;text-align:left;color:white;font-size:xx-small;">CIFAS</td>
</tr>
<tr>
<td class="tds" onmouseover="fadeImg2(8)" onmouseout="fadeImgend2(8)" onclick="window.top.content.location.href='FPI.htm'"; style="border:1px solid gray;background-color:#000066;width:150;text-align:left;color:white;font-size:xx-small;">Fraud Consultancy Team</td>
</tr>
<tr>
<td onmouseover="fadeImg2(9)" onmouseout="fadeImgend2(9)" onclick="window.top.useCont.location.href='http://www.intrawide.nbsnet.co.uk/livepub/secure/Finance/SID/Default.htm'"; style="border:1px solid gray;background-color:#000066;width:150;text-align:left;color:white;font-size:xx-small;">SID Newsletter (SID Employees Only)</td>
</tr>
</table>
</td></tr></table>
</script>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.