Click to See Complete Forum and Search --> : setting a target?


HackerX
07-08-2003, 02:23 PM
Hi I was wondering if you could help me. I have a page with 2 frames, a mainframe and a side navigational frame. In the side frame I have a javascript menu. What I want to do is to make the linked pages go to the main frame or a newwindow and I know that in HTML to do this with AHREF all you have to do is add a target but I tried that with this piece of javascript and it wont work. I also would like to change the font of the text inside the javascript menu and I have not been able to accomplish that like I would in HTML either. I have the whole script of the side frame (below) and in blue is my failed attempts at changing the font and setting a target. Please help me.

Thanks,
Josh

<HTML>
<HEAD>
<SCRIPT LANGUAGE="_JavaScript">
<!-- Begin
function locktrueie(myform){myform.ie.checked=true;}
function lockfalsenet(myform){myform.nets.checked=true;}
function goToURL() { window.location = ""; }
function nochange(mycheckbox)
{
if (mycheckbox.checked == true){mycheckbox.checked = false;}else{mycheckbox.checked = true;}
}
// End -->
</script>
</HEAD>
<BODY>
<style>
. tds
{
background-Color:BLACK;
width:100;
height:20;
text-align:center;
border:1px RED;
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,"");
//expl: apl[8] = new Array(45,"");
</script>
<body bgcolor="BLACK">
<BR>
<BR>
<BR>
<table style="border:1px RED; width:130;height:180" cellspacing=0 cellpadding=0>
<tr><td align=center bgcolor=BLACK>
<font size="7" face="bradley hand itc" color=RED><u>B4B</u></font><br>
</td></tr>
<tr><td align=center border=2>
<table cellpadding=0 cellspacing=0 name=link_table id=link_table>
<tr>
<td class="tds" onfiltered="fadeImg2(0)" onfiltered="fadeImgend2(0)" onfiltered="window.location='http://www.b4b.jimxorb.com/forum/index.php';" face="bradley hand itc" style="border:1px solid RED;background-color:BLACK;width:100;text-align:center;color:RED;" target="newwindow">B4B Forum</td>
</tr>
<tr>
<td class="tds" onfiltered="fadeImg2(1)" onfiltered="fadeImgend2(1)" onfiltered="window.location='http://www.the.iwarp.com/downloads.html';" face="bradley hand itc" style="border:1px solid RED;background-color:BLACK;width:100;text-align:center;color:RED;" target="newwindow">Downloads</td>
</tr>
<tr>
<td class="tds" onfiltered="fadeImg2(2)" onfiltered="fadeImgend2(2)" onfiltered="window.location='http://robotarena.tk/';" face="bradley hand itc" style="border:1px solid RED;background-color:BLACK;width:100;text-align:center;color:RED;" target="newwindow">Links</td>
</tr>
<tr>
<td class="tds" onfiltered="fadeImg2(3)" onfiltered="fadeImgend2(3)" onfiltered="window.location='http://www.the.iwarp.com/site.html';" face="bradley hand itc" style="border:1px solid RED;background-color:BLACK;width:100;text-align:center;color:RED;" target="newwindow">About Us</td>
</tr>
<tr>
<td class="tds" onfiltered="fadeImg2(4)" onfiltered="fadeImgend2(4)" onfiltered="window.location='http://www.the.iwarp.com/iamgehost.html';" face="bradley hand itc" style="border:1px solid RED;background-color:BLACK;width:100;text-align:center;color:RED;" target="newwindow">Image Hosts</td>
</tr>
<tr>
<td class="tds" onfiltered="fadeImg2(5)" onfiltered="fadeImgend2(5)" onfiltered="window.location='';" face="bradley hand itc" style="border:1px solid RED;background-color:BLACK;width:100;text-align:center;color:RED;" target="mainFrame"></td>
</tr>
<tr>
<td class="tds" onfiltered="fadeImg2(6)" onfiltered="fadeImgend2(6)" onfiltered="window.location='http://invisionfree.com/forums/Bots4Battle/';" face="bradley hand itc" style="border:1px solid RED;background-color:BLACK;width:100;text-align:center;color:RED;" target="newwindow">B5B Forum</td>
</tr>
<tr>
<td class="tds" onfiltered="fadeImg2(7)" onfiltered="fadeImgend2(7)" onfiltered="window.location='http://teamicer.to-j.com/Forums/';" face="bradley hand itc" style="border:1px solid RED;background-color:BLACK;width:100;text-align:center;color:RED;" target="newwindow">Old Forum</td>
</tr>
</table>
</td></tr></table>

HackerX
07-08-2003, 03:12 PM
cant you people help???

Jona
07-08-2003, 03:22 PM
Originally posted by HackerX
cant you people help???

Most probably, however when you post such a long message, you normally don't get a good reply. I'll take a small crack at it, though...

[J]ona

HackerX
07-08-2003, 03:23 PM
thanx

Jona
07-08-2003, 03:25 PM
Your font problem is probably because you do not have that font installed on your computer.

Your second problem is because you do not need a target, instead change window.location to parent.frameName.location.

[J]ona

HackerX
07-08-2003, 03:26 PM
the font is installed on my pc and could you please give me an expample of my window location because right now it is an address and I dont understand where you want me to put it. sorry but im pretty much a beginner with javascript and also how would I put it in a new window because I want to know how to do that to.

Jona
07-08-2003, 03:30 PM
<td class="tds" onfiltered="fadeImg2(0); fadeImgend2(0); parent.newwindow.location.href='http://www.b4b.jimxorb.com/forum/index.php';" style="font-family:bradley hand itc; border:1px solid RED; background-color:BLACK; width:100%; text-align:center; color:RED;">B4B Forum</td>


[J]ona

HackerX
07-08-2003, 03:31 PM
ill go try that thankyou so much!

HackerX
07-08-2003, 03:36 PM
um sorry but it changed the font but now its not a link...

http://www14.brinkster.com/rekcah/B4B/index.html

Jona
07-08-2003, 03:37 PM
Replace onfiltered with onClick.

[J]ona

HackerX
07-08-2003, 03:40 PM
i replaced onFilter with OnMouseOver like it was before and I was able to fix the fading effect with that but it still isnt a link, sry.

Jona
07-08-2003, 03:41 PM
Use <a href="#">Text</a> then.

[J]ona

HackerX
07-08-2003, 03:48 PM
so like this or what? I dont really understand again.

<td class="tds" onmouseover="fadeImg2(0)" onmouseout="fadeImgend2(0)" A HREF="http://www.b4b.jimxorb.com/forum/index.php" style="font-family:bradley hand itc; border:1px solid RED; background-color:BLACK; width:100%; text-align:center; color:RED;">B4B Forum</A></td>

Jona
07-08-2003, 03:52 PM
<td class="tds" onfiltered="fadeImg2(0); fadeImgend2(0); parent.newwindow.location.href='http://www.b4b.jimxorb.com/forum/index.php';" style="font-family:bradley hand itc; border:1px solid RED; background-color:BLACK; width:100%; text-align:center; color:RED;"><a href="http://www.b4b.jimxorb.com/forum/index.php" target="newwindow" onClick="return false;">B4B Forum</a></td>


[J]ona

HackerX
07-08-2003, 03:55 PM
um that really screwed it up... take a look:

http://www14.brinkster.com/rekcah/B4B/index.html

well nevermind I fixed it back but it just put it off to the right of the rest and in a normal link color and the link still didnt work...

nevermind again I figured out why it went off to the right, I accidentally deleted a line, anyways the link showed up like a normal link thats already been clicked(purple) which it shouldnt and when clicked on still didnt work.

Jona
07-08-2003, 04:01 PM
Take off the parent part. Just use newwindow.location.href.

[J]ona

Jona
07-08-2003, 04:03 PM
Actually, I think you are trying to load it in the right frame. If so, use parent.rightFrameName.location.href instead.

[J]ona

HackerX
07-08-2003, 04:08 PM
for the first one im trying to use a new window for the others the main frame for right now im just doing the new window and it still wont work, try my link here and you will see that it is just like normal text now:

http://www14.brinkster.com/rekcah/B4B/index.html

Jona
07-08-2003, 04:10 PM
onClick="window.open('http://yoursite.com/forum/');"


[J]ona

HackerX
07-08-2003, 04:13 PM
thankyou so much! that works now im going to try and load the others into the main frame if I need more help I'll be back.

Jona
07-08-2003, 04:15 PM
I'm sure you will. :)

[J]ona

HackerX
07-08-2003, 04:20 PM
so much for thinking I could do it myself... same thing happened to this one like the other one did, turned just like normal text, no link.

this is what I tried:


<tr>
<td class="tds" onmouseover="fadeImg2(1)" onmouseout="fadeImgend2(1)" parent.rightMainFrame.location.href='http://www.the.iwarp.com/downloads.html';" style="font-family:bradley hand itc; border:1px solid RED; background-color:BLACK; width:100%; text-align:center; color:RED;">Downloads</td>
</tr>

Jona
07-08-2003, 04:23 PM
Replace, "rightFrameName" with the name of the main frame.

[J]ona

HackerX
07-08-2003, 04:27 PM
didnt work...

Jona
07-08-2003, 04:29 PM
Replace "parent" with "top."
What is the name of your right frame (main frame)?

[J]ona

HackerX
07-08-2003, 04:33 PM
I have a left and a right frame my left frame is called leftnav and my right main frame is called main.

Jona
07-08-2003, 04:34 PM
Then it should be: top.main.location.href

[J]ona

HackerX
07-08-2003, 04:35 PM
still didnt work.

I used this:

<tr>
<td class="tds" onmouseover="fadeImg2(1)" onmouseout="fadeImgend2(1)" top.main.location.href='http://www.the.iwarp.com/downloads.html';" style="font-family:bradley hand itc; border:1px solid RED; background-color:BLACK; width:100%; text-align:center; color:RED;">Downloads</td>
</t>

Jona
07-08-2003, 04:39 PM
If that doesn't work, then your right frame isn't named "main."

[J]ona

HackerX
07-08-2003, 04:40 PM
yea I named it in my index.html look:

<HEAD>
<TITLE>- B4B - Bots4Battle -</TITLE>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>

<noscript><frameset rows='67,*' border=0>
<frame src='/cgi-bin/framedbanner?bgcolor=black&background=&align=center' marginheight=0 marginwidth=0 framespacing=0 frameborder=NO border=0 scrolling=no noresize name=fs_bannerframe></noscript>
<frameset cols="150,*" frameborder="0" border="0" bordercolor="Black">
<frame name="leftnav" src="http://www14.brinkster.com/rekcah/B4B/leftnav.html" marginwidth="0" marginheight="0" scrolling="none" frameborder="0" framespacing="0" noresize>
<frame name="main" src="http://www14.brinkster.com/rekcah/B4B/main.html" marginwidth="0" marginheight="0" scrolling="auto" frameborder="0" framespacing="0">
</frameset>

Jona
07-08-2003, 04:43 PM
Try this: top.frames["main"].location.href

[J]ona

HackerX
07-08-2003, 04:47 PM
sorry still wont work.

Jona
07-08-2003, 04:51 PM
It should.

[J]ona

Jona
07-08-2003, 04:55 PM
Okay, use this (since you had it all wrong): onClick="top.frames['main'].location.href...." etc.

[J]ona

HackerX
07-08-2003, 04:56 PM
ok thx alot that worked, thats all I need to know, I'll remember this site.

Jona
07-08-2003, 05:00 PM
OK.

[J]ona