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.css" 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("fiction",W+5,H+5);
placeIt("nfiction",W+475,H+5);
hideIt("ab");
hideIt("ficti;on")
hideIt("nfiction");
moveAvalon();
}
function moveAvalon() {
var y=yCoord("avalon");
if (y <= H+260) {
shiftIt("avalon",0,10);
shiftIt("books",0,10);
setTimeout("moveAvalon()",30);
} else {
moveBooks();
}
}
function moveBooks() {
var x=xCoord("books");
if (x <= W+320) {
shiftIt("books",10,0);
setTimeout("moveBooks()",50);
} else {
showObjects();
}
}
function showObjects() {
setTimeout("showIt('ab')",500);
setTimeout("showIt('fiction')",1000);
setTimeout("showIt('nfiction')",1500);
}
</script>
</head>
<body onload="placeObjects()">
<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.jpg" 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.jpg" alt="" /><br />
<b>AB Sales Rank: #1<br />
Nonfiction</b><br />
<i>Vietnam Memoirs</i><br />Gen. John Hartford
</div>
</body>
</html> 1 2453
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.css" 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("fiction",W+5,H+5); placeIt("nfiction",W+475,H+5); hideIt("ab"); hideIt("ficti;on")
Is that a typo?
hideIt("nfiction"); moveAvalon(); }
function moveAvalon() { var y=yCoord("avalon"); if (y <= H+260) { shiftIt("avalon",0,10); shiftIt("books",0,10); setTimeout("moveAvalon()",30); } else { moveBooks(); }
}
function moveBooks() { var x=xCoord("books"); if (x <= W+320) { shiftIt("books",10,0); setTimeout("moveBooks()",50); } else { showObjects();
} }
function showObjects() { setTimeout("showIt('ab')",500); setTimeout("showIt('fiction')",1000); setTimeout("showIt('nfiction')",1500); } </script> </head>
<body onload="placeObjects()">
<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.jpg" 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.jpg" 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
Javascriptconsole open.
It contains errors with descriptions, and that is the way to go if you want
to debug your code.
Regards,
Erwin Moller This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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...
|
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...
|
by: Sudheer Kareem |
last post by:
Dear All
Please tell me how to assosiate help files with my Vb.net
Project.
Regards
Sudheer
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
| |
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,...
|
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...
|
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...
|
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,...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
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 ...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |