473,840 Members | 1,523 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 2474
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
6577
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 reformatting my system. Prior to the reformatting, I copied the help.rtf file onto a CD and checked the box to...
9
4426
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 the "help" button, in other words. I thought it would be os.spawnv(os.P_DETACH,...
4
3359
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
6493
by: Sudheer Kareem | last post by:
Dear All Please tell me how to assosiate help files with my Vb.net Project. Regards Sudheer
6
3032
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 a freeware html authoring tool is directed towards?
3
3373
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
2644
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 sent it out to a site, the help file was not able to be accessed because it was my path in the...
9
2253
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 sensitive stuff. TIA
8
3243
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
2903
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 case of Help, I see the Help of Excel and help of my application, both as a submenu of help. ...
0
9860
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9699
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10658
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10300
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9437
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7023
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4498
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
2
4072
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.