Topic: I gotta html question, and im stuck, can anyone answer it? Pages that link to <a href="https://ozoneasylum.com/backlink?for=9721" title="Pages that link to Topic: I gotta html question, and im stuck, can anyone answer it?" rel="nofollow" >Topic: I gotta html question, and im stuck, can anyone answer it?\

 
Author Thread
XtremeOS
Obsessive-Compulsive (I) Inmate

From: BAtavia, Il, USA
Insane since: Feb 2004

IP logged posted posted 02-24-2004 04:55 Edit Quote

i just got into java and html and im readin through a java book and this is a exercise, i just cant get it working it looks good but wont load the other pictures, can anyone help?

here is the link http://home.earthlink.net/~mr_vercetti/Precaching%20Images.htm
its set up on my ftp


<HTML>
<HEAD>
<TITLE>Image Object</TITLE>

<script language="JavaScript">
<!--

function SymError()
{
return true;
}

window.onerror = SymError;

//-->
</script>

<SCRIPT LANGUAGE="JavaScript">
// pre-cache four images
image1 = new image(120,90)
image1.src = "http://home.earthlink.net/~mr_vercetti/chick.bmp"
image2 = new image(120,90)
image2.src = "http://home.earthlink.net/~mr_vercetti/jenna.jpg"
image3 = new image(120,90)
image3.src = "http://home.earthlink.net/~mr_vercetti/Mechina/Mechina-Banner.gif"
image4 = new image(120,90)
image4.src = "http://home.earthlink.net/~mr_vercetti/Mechina/a.jpg"

// load an image chosen from select list
function loadCached(list) {
var img = list.options[list.selectedIndex].value
document.thumbnail.src = eval(imag + ".src")
}
</SCRIPT>
</HEAD>

<BODY>
<H2>Image Object</H2>
<IMG SRC="chick.bmp" NAME="thumbnail" HEIGHT=90 WIDTH=120>
<FORM>
<SELECT NAME="cached" onChange=loadCached(this)">
<OPTION VALUE="image1">Funny
<OPTION VALUE="image2">Funny as Hell!!
<OPTION VALUE="image3">haha
<OPTION VALUE="image4">yea right
</SELECT>
</FORM>
</BODY>
</HTML>

haha

MedHead
Nervous Wreck (II) Inmate

From:
Insane since: Feb 2004

IP logged posted posted 02-24-2004 06:32 Edit Quote

Well, I'm not great at debugging javascript, but it appears to me that you're missing the declaration of what the images are. You have the images there, but they're not defined as anything, so that when your javascript calls for LoadCached(this), there isn't any Cached list. That or because the name for your drop down combo box is "cached" and your javscript calles for "Cached". As I said, not that great at debugging javascript, especially when I'm not warmed up.

First post too, by the way.

Wes
Paranoid (IV) Mad Scientist

From: Inside THE BOX
Insane since: May 2000

IP logged posted posted 02-24-2004 14:40 Edit Quote

Incidentally, Java does not equal JavaScript. May help you avoid some confusion in the future.


DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

IP logged posted posted 02-24-2004 19:10 Edit Quote

Yep, Java != Javascript, and this != an HTML question



Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 02-24-2004 19:17 Edit Quote

You have a JavaScript error: line 27, unterminated string constant. Looks like you forgot the opening quotation mark in onChange=loadCached(this)".



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu