PDA

View Full Version : javascript problems


Wilbert
8th February 2004, 22:04
Not sure whether this is the right forum ...

I'm preparing a guide and have some problems with javascript. I want to do the same as doom in his codec comparisons. That is, click on a codec, and the corresponding screenshot pops up next to it (with comments below the screenshot).

The problem is that I don't know how to do it. I tried the following


<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<script type="text/javascript">
var mainimagewidth = 640;
var mainimageheight = 480;

// This is the directory all the images for this page are in
var imagerootdir = "1200/";

// The list of codecs
// Be sure to have an entry below for each of codecs
var codeclist = new Array("original", "XviD");

// The number of image sets we have
var numimagesets = 1;
var imagedata = new Array(numimagesets);

// Per image in the set, use the file name and the description text
imagedata[0] = new Array(
new Array("55.bmp", "Hey"),
new Array("56.bmp", "Hey2"),
</script>
</head>

<body onload="OnLoadMainFunction();" onresize="ResetObjectPositions();">
<script type="text/javascript">
GenerateImageTable(0);
</script>
</body>
</html>


It doesn't work, and I can't find some proper docs on the internet. I hope someone can help?

A very simplied script looks like the following


<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<script type="text/javascript">
var mainimagewidth = 640;
var mainimageheight = 480;

// This is the directory all the images for this page are in
var imagerootdir = "1200/";

// The list of codecs
// Be sure to have an entry below for each of codecs
var codeclist = new Array("original");

// The number of image sets we have
var numimagesets = 1;
var imagedata = new Array(numimagesets);

// Per image in the set, use the file name and the description text
imagedata[0] = new Array("55.bmp");
</script>
</head>

<body onload="OnLoadMainFunction();" onresize="ResetObjectPositions();">
<script type="text/javascript">
document.write('<img border="0" src="' + imagerootdir + imagedata[0] + '">');
</script>
</body>
</html>


It shows my picture, but it gives also an error message: object expected, line 32 (the </script> line). What does that mean?

Btw, I'm using FrontPage.

avih
8th February 2004, 23:09
1st, go to my post on mozillazine (http://forums.mozillazine.org/viewtopic.php?p=346419#346419) forums regarding JS learning starting points.

then you can use mozilla, it has a built in JS debugger, might give u better alerts than IE. also, without using the JS debugger, you can also use the JS console (both mozilla/firebird) to get quick info regarding script errors.

i might have a look at your code later.