473,545 Members | 1,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help! I need a javascript expert

Can someone please take a look at my javascript and tell me what's wrong
with it. The script is suppose to move words and pics, but I can't get it to
work. Thanks.

JC

<html>
<head>
<!--
New Perspectives on HTML, XHTML, and DHTML
Tutorial 11
Tutorial Case

Avalon Books
Author:
Date: 4/5/2006

Filename: avalon.htm
Supporting files: ab.jpg, fiction.jpg, nfiction.jpg, scripts.js,
styles.css
-->
<title>Avalon Books</title>
<link href="styles.cs s" rel="stylesheet " type="text/css" />

<script src="scripts.js " type="text/JavaScript"></script>
<script type="text/javascript">

W=(winWidth()-620)/2;
H=(winHeight()-300)/2;
function placeObjects() {
placeIt("avalon ", W+175,H+10);
placeIt("books" ,W+175,H+10);
placeIt("ab",W+ 230,H+40);
placeIt("fictio n",W+5,H+5);
placeIt("nficti on",W+475,H+5 );
hideIt("ab");
hideIt("ficti;o n")
hideIt("nfictio n");
moveAvalon();
}

function moveAvalon() {
var y=yCoord("avalo n");
if (y <= H+260) {
shiftIt("avalon ",0,10);
shiftIt("books" ,0,10);
setTimeout("mov eAvalon()",30);
} else {
moveBooks();
}

}

function moveBooks() {
var x=xCoord("books ");
if (x <= W+320) {
shiftIt("books" ,10,0);
setTimeout("mov eBooks()",50);
} else {
showObjects();

}
}

function showObjects() {
setTimeout("sho wIt('ab')",500) ;
setTimeout("sho wIt('fiction')" ,1000);
setTimeout("sho wIt('nfiction') ",1500);
}
</script>
</head>

<body onload="placeOb jects()">

<div id="avalon">
AVALON
</div>

<div id="books">
BOOKS
</div>

<div id="ab">
<a href="#">
<img src="ab.jpg" alt="Click to enter store" />
</a>
</div>

<div id="fiction">
<img src="fiction.jp g" alt="" /><br />
<b>AB Sales Rank: #1<br />
Fiction</b><br />
<i>Before the Fall</i><br />Jeffrey Unwin
</div>

<div id="nfiction">
<img src="nfiction.j pg" alt="" /><br />
<b>AB Sales Rank: #1<br />
Nonfiction</b><br />
<i>Vietnam Memoirs</i><br />Gen. John Hartford
</div>

</body>
</html>
Apr 12 '06 #1
1 2461
John Russell wrote:
Hi John,

You might consider using a more descriptive subject next posting. :-)

Can someone please take a look at my javascript and tell me what's wrong
with it. The script is suppose to move words and pics, but I can't get it
to work. Thanks.

JC

<html>
<head>
<!--
New Perspectives on HTML, XHTML, and DHTML
Tutorial 11
Tutorial Case

Avalon Books
Author:
Date: 4/5/2006

Filename: avalon.htm
Supporting files: ab.jpg, fiction.jpg, nfiction.jpg, scripts.js,
styles.css
-->
<title>Avalon Books</title>
<link href="styles.cs s" rel="stylesheet " type="text/css" />

<script src="scripts.js " type="text/JavaScript"></script>
What is included here?

Maybe the missing placeIt function?
<script type="text/javascript">

W=(winWidth()-620)/2;
H=(winHeight()-300)/2;
function placeObjects() {
placeIt("avalon ", W+175,H+10);
placeIt("books" ,W+175,H+10);
placeIt("ab",W+ 230,H+40);
placeIt("fictio n",W+5,H+5);
placeIt("nficti on",W+475,H+5 );
hideIt("ab");
hideIt("ficti;o n")
Is that a typo?
hideIt("nfictio n");
moveAvalon();
}

function moveAvalon() {
var y=yCoord("avalo n");
if (y <= H+260) {
shiftIt("avalon ",0,10);
shiftIt("books" ,0,10);
setTimeout("mov eAvalon()",30);
} else {
moveBooks();
}

}

function moveBooks() {
var x=xCoord("books ");
if (x <= W+320) {
shiftIt("books" ,10,0);
setTimeout("mov eBooks()",50);
} else {
showObjects();

}
}

function showObjects() {
setTimeout("sho wIt('ab')",500) ;
setTimeout("sho wIt('fiction')" ,1000);
setTimeout("sho wIt('nfiction') ",1500);
}
</script>
</head>

<body onload="placeOb jects()">

<div id="avalon">
AVALON
</div>

<div id="books">
BOOKS
</div>

<div id="ab">
<a href="#">
<img src="ab.jpg" alt="Click to enter store" />
</a>
</div>

<div id="fiction">
<img src="fiction.jp g" alt="" /><br />
<b>AB Sales Rank: #1<br />
Fiction</b><br />
<i>Before the Fall</i><br />Jeffrey Unwin
</div>

<div id="nfiction">
<img src="nfiction.j pg" alt="" /><br />
<b>AB Sales Rank: #1<br />
Nonfiction</b><br />
<i>Vietnam Memoirs</i><br />Gen. John Hartford
</div>

</body>
</html>

As far as I can tell this is what happens:
1) onLoad in the bodytag calls function placeObjects()
2) in placeObjects() two missing functions are called:
- placeIt()
- hideIt()

I have no clue how these functions look or what they are doing.

So the detective work stops here.

If you want to debug your code, run it in Firefox and keep the
Javascriptconso le open.
It contains errors with descriptions, and that is the way to go if you want
to debug your code.

Regards,
Erwin Moller
Apr 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
6494
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help Workshop program: hcw.exe that's included with Visual Basic. This exact same file compiled perfectly with no notes, warnings or errors prior to...
9
4385
by: Tom | last post by:
A question for gui application programmers. . . I 've got some GUI programs, written in Python/wxPython, and I've got a help button and a help menu item. Also, I've got a compiled file made with the microsoft HTML workshop utility, lets call it c:\path\help.chm. My question is how do you launch it from the GUI? What logic do I put behind...
4
3329
by: Sarir Khamsi | last post by:
Is there a way to get help the way you get it from the Python interpreter (eg, 'help(dir)' gives help on the 'dir' command) in the module cmd.Cmd? I know how to add commands and help text to cmd.Cmd but I would also like to get the man-page-like help for classes and functions. Does anyone know how to do that? Thanks. Sarir
2
6399
by: Sudheer Kareem | last post by:
Dear All Please tell me how to assosiate help files with my Vb.net Project. Regards Sudheer
6
2993
by: d.warnermurray | last post by:
I am doing a project for school that involves creating help files for a html authoring tool. If you could help me with answers to some questions it would really help. 1. What tasks do you expect an html authoring tool to help you accomplish? 2. What do you expect from online help for a html authoring tool? 3. What audience do you think...
3
3329
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With numarray, help gives unhelpful responses:
4
2608
by: dixie | last post by:
Help, I'm really out of my depth here (not unusual I hear you say :-). I have just installed HTML Help in an application. I told it in the Project Properties the path to the help file. I then type in a command line that runs the help in the correct Context from a button on each form. It all worked fine - HERE. The problem is that when I...
9
2234
by: JJ | last post by:
Do you all use HTML help workshop to create your help system. I am finding it quite clumsy to use. Mayeb because I am not used to using it. Do any of you use any other techniques to create help for your progs? Whats the current popular approach to creating help? I am only wanting a straight help file accessible from a menu - no context...
8
3208
by: Mark | last post by:
I have loaded Visual Studio .net on my home computer and my laptop, but my home computer has an abbreviated help screen not 2% of the help on my laptop. All the settings look the same on both including search the internet for help, but the help is worthless. Any ideas?
0
2853
by: hitencontractor | last post by:
I am working on .NET Version 2003 making an SDI application that calls MS Excel 2003. I added a menu item called "MyApp Help" in the end of the menu bar to show Help-> About. The application calls MS Excel, so the scenario is that I am supposed to see the Excel Menu bar, FILE EDIT VIEW INSERT ... HELP. I am able to see the menu bar, but in...
0
7457
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7391
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7802
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7410
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5320
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4941
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3438
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1869
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1010
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.