...

View Full Version : Need help with a script i found online



danacton
07-01-2003, 05:01 PM
I found this script on the Web and while it seems to work in i.e. - it doesn't work in navigator - at least not in 7.0. I don't know much about this yet, can someone help me get it to work in navigator.

Any help anyone might be able to offer would be greatly appreciated.

Thanks

Dan


<!--
function buildMenu() {
speed=0;
topdistance=123;
items=4;
y=-50;
ob=1;
if (navigator.appName == "Netscape") {
v=".top=",dS="document.",sD="";
}
else {
v=".pixelTop=",dS="",sD=".style";
}
}
function scrollItems() {
if (ob<items+1) {
objectX="object"+ob; y+=10; eval(dS + objectX + sD + v + y);
if (y<topdistance) setTimeout("scrollItems()",speed);
else y=-50, topdistance+=40, ob+=1, setTimeout("scrollItems()",speed);
}
}
-->

Graeme Hackston
07-01-2003, 05:25 PM
Just a guess, try it like this


function buildMenu() {
speed=0;
topdistance=123;
items=4;
y=-50;
ob=1;
v=".pixelTop=",dS="",sD=".style";
}

function scrollItems() {
if (ob<items+1) {
objectX="object"+ob; y+=10; eval(dS + objectX + sD + v + y);
if (y<topdistance) setTimeout("scrollItems()",speed);
else y=-50, topdistance+=40, ob+=1, setTimeout("scrollItems()",speed);
}
}

A link to the original script would help

danacton
07-01-2003, 10:35 PM
Graeme,

thanks for the quick reply.

I tried your revised code in i.e. and it works fine; however, it still won't work in navigator 7.0

I see you took out the navigator if/else statement.

I cannot recall where i got the script, but I can attach the pages so that you can see how it works in internet explorer.




P.S. I have another big project I could use some help with. I see you're a CF addict - that's great. I'm just starting out with CFMX and may have bitten off more than I can chew! I have to create a site where the homepage is automatically updated when the admin selects a given radiobutton. Maybe there's a tutorial that you know of that could help me. I've searched high and low for keywords and haven't found any yet.

But first things first - if you're willing

cheesebagpipe
07-01-2003, 10:56 PM
CF == Coding Forums

That script has whiskers on it...it's pretty much an old IE4 vs. Navigator script. I'd forget it and look around for others, plenty to choose from.

Good luck with your CF! ;)

Graeme Hackston
07-01-2003, 11:06 PM
I agree with cheesebagpipe. Also, I'm looking at home.html now and it's full of syntax errors.

1 reason the JS isn't working in NN is because it's reffering to element IDs directly. That's an outdated IE only method.

I corrected the syntax errors I found in the page and I'll see if the JS can easily be modernized.

<added>
more syntax errors in the js file. Don't use <!-- in js files
</added>

Graeme Hackston
07-01-2003, 11:35 PM
Ok, here's home.html and navmenu.js working in Mozilla 1.4


<html>
<head>
<style type="text/css">
<!--
A:hover{COLOR: #cccccc;
FONT-WEIGHT: bolder;
text-decoration:none;
margin-left:20px}
-->
</style>
<script type="text/javascript" src="navmenu.js"></script>

<style type="text/css">
#image1{float:center;padding:3px;}
</style>


<link rel="stylesheet" type="text/css" href="master_style_sheet.css">
<title>dansworth
</title>
</head>
<body bgcolor="#339999">
<div class="mainpanel">
<h1>Welcome to dansworth!<br></h1>

<h2><p>We Translate The Mind's Vision - Into Reality</p></h2>

<h3>There's No Project Too Large Or Small For dansworth</h3>

<h3><p>Here at dansworth we commit great resources into a vision of
simplicity. We stress this concept in all of our projects and we're proving
or perhaps improving on the age old adage of "keeping it simple".
</div>
<div class="nestedpanel">
Please send an email if you've seen any of our work on the Internet and we've sparked an
interest. Sorry for the inconvenience of our "Work in Progress"site here at U.A.T.</h3>
<p>Please send your email to <A HREF="mailto:danacton@uat.edu" TARGET="_top" TITLE="mailto:danacton@uat.edu"><font color="lime"><U>dansworth</U></A></font></p></h3>
- or give us a call at:<br/><b> 602-275-2352</b>
</div>

<div class="banner1">
<img id="image1" src="images/banner.gif">
</div>
<div class="banner2">
<img id="image1" src="images/banner.gif">
</div>
<div class="banner3">
<img id="image1" src="images/banner.gif">
</div>
<div class="banner4">
<img id="image1" src="images/banner.gif">
</div>
<div class="banner5">
<img id="image1" src="images/banner.gif">
</div>
<div class="banner6">
<img id="image1" src="images/banner.gif">
</div>
<div class="banner7">
<img id="image1" src="images/banner.gif">

<!-- navigation ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////-->
<div class="navigation" id="object1">
<table bgColor=#087b7b border=0 width=150 style="font-size:13px;font-style:italic;font-weight:900;text-decoration:none">
<tbody>
<tr>
<td>
<center><a href="home.html"><font
face="Tahoma"><font color=lime>Home</font></a>
</center></td></tr></tbody></table></div>

<div class="navigation" id="object2">
<table bgColor=#087b7b border=0 width=150 style="font-size:13px;font-style:italic;font-weight:900;text-decoration:none">
<TBODY>
<tr>
<td>
<center><a href="services.html"><font
face="Tahoma"><font color=lime>Services</font></a>
</center></td></tr></tbody></table></div>

<div class="navigation" id="object3">
<table bgColor=#087b7b border=0 width=150 style="font-size:13px;font-style:italic;font-weight:900;text-decoration:none">
<TBODY>
<tr>
<td>
<center><a href="aboutus.html"><font
face="Tahoma"><font color=lime>About Us</font></a>
</center></td></tr></tbody></table></div>


<div class="navigation" id="object4">
<table bgColor=#087b7b border=0 width=150 style="font-size:13px;font-style:italic;font-weight:900;text-decoration:none">
<TBODY>
<tr>
<td>
<center><a href="contactus.html"><font
face="Tahoma"><font color=lime>Contact Us</font></a>
</center></td></tr></tbody></table></div>

<div class="footer">
<a href=http://www.uat.edu target=_blank><img src="images/UATBanner005.gif" alt="Hosted by The University of Advancing Technology"></a>
</div>

</body>
</html>



JS file


onload = function() {
for (var i= 0; i<20; i++) {
if (EL('object' + i)) {
window['object' + i] = EL('object' + i)
}
}
buildMenu()
scrollItems()
}

function buildMenu() {
speed=0;
topdistance=123;
items=4;
y=-50;
ob=1;
v=".top=",dS="document.",sD="";
v=".top=",dS="",sD=".style";
}

function scrollItems() {
if (ob<items+1) {
objectX="object"+ob
y+=10
var function_str = new Function(dS + objectX + sD + v + y)
function_str()
if (y<topdistance) setTimeout("scrollItems()",speed);
else y=-50, topdistance+=40, ob+=1, setTimeout("scrollItems()",speed)
}
}

function EL(el) {
return document.getElementById(el)
}


<edit>
I noticed I added an array that wasn't needed, I removed it.
</edit>

Graeme Hackston
07-02-2003, 12:05 AM
I have to create a site where the homepage is automatically updated when the admin selects a given radiobutton.
You'll need to further explain what you want to do. Will this radio button be on or offline?

danacton
07-02-2003, 08:39 PM
To answer your question as to whether or not the radiobutton would be online:

I guess that you would say it is online in that it will be able to be accessed from anyone with admin. rights so that content can be entered into the database from anywhere - and the homepage can be updated from anywhere.

Graeme Hackston
07-03-2003, 01:40 AM
Did you get the menu working in NN?

I think you'll have to use server side languages which I don't know.

Try asking a question in one of these forums.
http://www.codingforums.com/forumdisplay.php?s=&forumid=4

danacton
07-16-2003, 04:21 PM
Graeme,

Sorry it's been so long, but yes - thanks for your help in the code for the web page. It works in navigator 7.0 and I cannot thank you enough.

I didn't think you had replied to my last post - but thanks again.

:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum