//flex table opened by JP

Click to See Complete Forum and Search --> : JavaScript - HTML Question


netsurfer
02-09-2000, 10:28 PM
I haven't seen anyone ask these sort of questions here... so I'll pray that they're allowed here. Okay, here we go:

I have two websites ( www.torrancehigh.com (http://www.torrancehigh.com) and www.subspace.net/ths (http://www.subspace.net/ths)) and both are mirrors of each other. The only difference between them is that they each have site statistics accounts.

I have placed a link to the site statistics page, and figured it'd be easier to use a javascript to figure out which URL to show (show link to account A, or show link to account B). okay okay, I've done this already. With the old navigation bar (as featured on the pages currently), this was the code:


<SCRIPT>
var URLtoGoTo = "www.torrancehigh.com";
var URLat = location.hostname;

if(URLtoGoTo == URLat)
{
document.write('<A HREF="http://www.thecounter.com/counter/235980.vmain">Site Statistics</A>');
}
else
{
document.write('<A HREF="http://www.thecounter.com/counter/50307.vmain">Site Statistics</A>');
}
</SCRIPT>



And that worked just fine... Except, I've gotten a little creative and borrowed a few ideas from the navbar at www.webmonkey.com (http://www.webmonkey.com) for a new layout. Anyway, the new navbar is at http://www.subspace.net/ths/ftree/thsftree.html

It looks familiar right? Anyway, if you click About, then point to Site Statistics, it shows the URL in the status bar, which it shouldn't... it should onmouseover - display "Site Statistics."

And here's the code I've written to do it, but currently does not work.


<SCRIPT LANGUAGE="JavaScript">
var URLtoGoTo = "www.torrancehigh.com";
var URLat = location.hostname;
if (URLtoGoTo == URLat)
{
document.write('*')
document.write('<A class="sublinks" HREF="http://www.thecounter.com/counter/235980.vmain" "onmouseover=self.status=Site Statistics; return true" "onmouseout=self.status=; return true">Site Statistics</A>')
}
else
{
document.write('*')
document.write('<A class="sublinks" HREF="http://www.thecounter.com/counter/50307.vmain" "onmouseover=self.status=Site Statistics; return true" "onmouseout=self.status=; return true">Site Statistics</A>')
}
</SCRIPT>


I already thought of a way to optimize this... If (blah) is true, assign the account number to a new variable, else, assign the other account number to a new variable. Then just do one document.write and insert the variable where appropriate... Unfortunately, I can't even get the long way to work properly... so the optimization isn't feasible yet... you can see what I mean here:


<SCRIPT LANGUAGE="JavaScript">
var URLtoGoTo = "www.torrancehigh.com";
var URLat = location.hostname;
var acct;

if(URLtoGoTo == URLat)
{ acct = 235980; }
else
{ acct = 50307; }
document.write('*')
document.write('<A class="sublinks" HREF="http://www.thecounter.com/counter/+[acct].vmain" "onMouseOver=self.status='Site Statistics'; return true" "onmouseout=self.status=''; return true">Site Statistics</A>');
*/


So, is it possible to have all that stuff in document.write? Or would it be better to break things down and reassemble them? (which I don't know how to do)...

help!!! http://www.sysopt.com/forum/smile.gif

-edit-Scott! Where is the Preview (rather than plain ol Submit Now) button ?! http://www.sysopt.com/forum/smile.gif

[This message has been edited by netsurfer (edited 02-09-2000).]

netsurfer
02-12-2000, 11:03 AM
Please! *on hands and knees* http://www.sysopt.com/forum/frown.gif

Or can you suggest any other forums (mainly javascript) I look into?

smokin1
02-12-2000, 11:12 AM
Barta has a lot of info and some links http://junior.apk.net/~jbarta/weblinks/javascript.html
Maybe what you need is here
http://www.sysopt.com/forum/smile.gif

jad1097
02-12-2000, 11:50 AM
Maybe here http://www.developer.com/directories/featured/javascript.html

SysOpt
02-12-2000, 11:55 AM
Try these? http://www.javagoodies.com http://www.javascripts.com