I need lots of help. 1-dialog box not working, 2-css background not working

They have: 4 posts

Joined: Nov 2001

PLEASE HELP ME. I have several problems I have not been able to figure what is wrong.http://www.geocities.com/trishbehlings

1- I love crafts on my page should move starting at coordinates 150,10 moving in increments of 50 and stopping at position 500,10. It won't move.

2- after you click on the link under the girls pictures the picture changes and a pop up window should appear but it's not.

3-I'm trying to make a external style sheet. I typed it in notepad and uploaded it to geocities but the background image is not working.
here is my file.

H2{font-family:Ariel,Helvetica;font-size:14pt;font-weight:bold}

Div{font-family:Ariel,Helvetica}

BODY{background-image:url("/images/cntrylaneheartstileback.gif");}
{font-family:Ariel,Helvetica;color:black;font-size:11pt}
a:link{color:885522}
a:visited{color:brown}
a:hover{color:black}
a:active{color:blue}:confused: Confused

Busy's picture

He has: 6,151 posts

Joined: May 2001

you have a javascript error, if you use version4 netscape you can just type in javascript: (":" is important), this is what it displays:

JavaScript Error: http://www.geocities.com/trishbehlings/, line 61:

missing ; before statement.

document.all.ilovecrafts.style.pixelLeft=document.all.ilove crafts.style.pixelLeft+dx;
............................................................................^

JavaScript Error: http://www.geocities.com/trishbehlings/, line
111:

missing ( before formal parameters.

{
^

JavaScript Error: http://www.geocities.com/trishbehlings/, line 79:

moveIt is not defined.

the javascript error could be affecting the picture change as well,

The stylesheet, the link you have to the image is different in the stylesheet than it is on the pages body tag, check the directory the image is in, also you dont need name= in the link tag.
the font tag in the stylesheet under the body tag? is this meant to be apart of the body section? if so remove the extra }{'s after the background image and before the font bit.

They have: 4 posts

Joined: Nov 2001

THank You for your quick reply. Javascript is very new to me. I have know idea what to do with the errors you found. I did go to javascript: but what do they mean? How do I define moveit?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

1. no quotes around the url for the bg image
2. make sure the image is there on the server
3. validate that CSS, it's a mess! below is a fixed up version, syntactically, anyway

H2 {
font-family:Ariel,Helvetica, sans-serif;
font-size:14pt;
font-weight:bold;}

Div {
font-family:Ariel, Helvetica, sans-serif;}

BODY {
background-image:url(/images/cntrylaneheartstileback.gif);
font-family:Ariel,Helvetica, sans-serif;
color:black;
font-size:11pt;}

a:link {
color: #885522;}

a:visited {
color:brown;}

a:hover {
color:black;}

a:active {
color:blue;}

hth,

Smiling Suzanne

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

You don't have anything in that link telling it to open a window.

You can use the same script that you use for the fullerton popup. There are better scripts, but let's leave that aside for the moment.

Click Here

You would, of course, change the url and the window size as needed. As an aside, it's not very nice to open offsite links in windows without any menus, et cetera, and not even resizable. Why not just use target="_blank" in the hyperlink? It's far kinder to users.

Also, the background is showing up now.

Smiling Suzanne

They have: 4 posts

Joined: Nov 2001

Suzanne,
I have been trying to get this straightened out for over 2 weeks and the teacher refuses to help and the text book is as bad as the teacher.

Problem 1- after the user clicks the link under the girls photo, the photo will change then I need a confirmation dialog box asking the user to indicate their approval of the new photo.

Problem 2-The text at the top "I love crafts" is suppose to be animated.starting at coordinates 150,10 then move in increments of 50 and stopping at position 500,10.

The background is now working on the css file.
How do i include a style for the tags that display the Welcome Netscape and Explorer user for the browser detection?

I REALLY APPRECIATE ALL THE HELP!! and so do my girls cause i have been a bear lately triing to get these to work.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Okay, one thing at a time:

Quote: Problem 1- after the user clicks the link under the girls photo, the photo will change then I need a confirmation dialog box asking the user to indicate their approval of the new photo.

Solution: you need to use the confirmation script (in the tags:

<script language="JavaScript" type="text/javascript">
<!--
// for confirm message dialog and redirect

var msg = "your message";

functionName {
     if (confirm(msg))
change('foo', 'amber.jpg');
}
//-->
&lt;/script&gt;
'

Click Here

I would recommend that you pick up something like JavaScript the Definitive Guide (O'Reilly) or anything by Dori Smith at http://www.peachpit.com/about/author.bios/dori.smith.html -- that way you can look up the information on an as needed basis.

You can also add an else to the function, so if no confirm, something entirely different happens.

Quote: The background is now working on the css file.
How do i include a style for the tags that display the Welcome Netscape and Explorer user for the browser detection?

Solution: Use document.write to write the tags in as well, not just the message. However, you will want to move that JavaScript to within the body tag in order for it to work properly and for the code to be valid.

document.write('Welcome Internet Explorer 4 or higher User.')

** note the different use of quote -- to keep yourself sane, I recommend that you use only single quotes for JavaScript and double quotes for HTML. While you can mix and match, it's easier to keep them separate for troubleshooing purposes **

And in the CSS, have:

.welcome {
font-family: whatever, generic;
font-size: xxpt;
}

Quote: Problem 2-The text at the top "I love crafts" is suppose to be animated.starting at coordinates 150,10 then move in increments of 50 and stopping at position 500,10.

Solution: get better at checking your syntax:

;document.all. <-- this line starts with a semi-colon, it shouldn't be there

If you used this script from Dynamic Drive, make sure you leave the copyrights in place. (I didn't look, just noticed the credit at the bottom). Otherwise, try going step by step through the code looking for errant keystrokes (the Wink or syntax errors.

Good luck,

Smiling Suzanne

P.S. I've edited this a zillion times to fix my own typos and syntax errors, so it happens to everyone!

They have: 4 posts

Joined: Nov 2001

I deleted the ; before document.all but it is still not working.

Also on the confirm box were abouts do I put the call?

I did buy a book yesterday called "Sams teach yourself Javascript in 24 hours". I stayed up till 2am last night reading it. I was able to make dialog boxes appear onload of page but not sure how to make it appear after a onclick event.

No where on the internet have I been able to find out about making the text move without using a marque.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

I would recommend you don't use an onClick event, or if you do, put the confirmation dialog in a function in the HEAD tags, like I suggested, and call the function in the onClick.

I think Vinny would be better able to answer this, as I'm way rusty.

Are you using someone else's script for the making text move part? Or is it your own?

Have you tried going through the code character by character? Or recut & pasting if it's not your code?

Smiling Suzanne

P.S. Did the other things work for you?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

The extra scripting from Yahoo could be conflicting with the JavaScript on your page. Without going into the code myself (and doing your homework for you!), see if you can get it working properly on your harddrive and then upload it and see if there is a difference.

Smiling Suzanne

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Okay, I'm a masochist tonight.

You really really really need to get a book that goes over the fundamentals. I'm sorry that I overestimated your javascript knowledge. When you create a function, it looks like this:

          <!--confirm dialog box-->
  &lt;script language="JavaScript" type="text/javascript"&gt;
<!--
// for confirm message dialog and redirect

var msg = "I am soo cute!";

function amber() {
     if (confirm(msg))
        change('foo', 'amber.jpg');
}
//-->
&lt;/script&gt;
'

See where I had functionName? That is now changed to function and the name amber().

You can use IE to detect JavaScript errors -- it will report the line and character and the problem, which will help you troubleshoot, but without a reference guide like The Definitive Guide, you will still be lost, likely.

As for the rest, you have a number of errors in the message JavaScript -- take out the extra quotes, and check your syntax. I can't emphasize that enough.

For the moving piece, you haven't defined the browser. You define the browsers in another script, so you can use the same definitions -- at this point "nn" means nothing to the browser. n4, however, would, since you defined that earlier.

Really, really, really, you need to go through it line by line, character by character and check your work.

Suzanne

P.S. By fixing the syntax errors and the missing browser definitions/variable names, I had it working off my hard drive. Note that you will have to change the variable name to br from browser as well.

If you really get stuck, trying to fix this, post again and we'll break it down further. I really want you to be able to do this on your own, though, so that you come out of this with a sense of "I CAN DO THIS!", not "someone gave me the solution, I don't know what I'm doing".

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.