Jump to content

[SOLVED] Object has no properties


xiao

Recommended Posts

I have something that looks like this:

<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function veranderAfbeelding()
{
var begin = document.behuizing.value.search(/>>>/);
var einde = document.behuizing.value.search(/<<</);
document.afbeelding.src = document.behuizing.options[document.behuizing.selectedIndex].value.substring(begin,einde);
}
function vorigeAfbeelding()
{
if(document.behuizing.selectedIndex != 0)
{
	document.behuizing.selectedIndex--;
}
veranderAfbeelding();
}
function volgendeAfbeelding()
{
if(document.behuizing.selectedIndex != document.behuizing.options.length-1)
{
	document.behuizing.selectedIndex++;
}
veranderAfbeelding();
}
//  End -->
</script>
</head>
<body onLoad="javascript:veranderAfbeelding()">
<form action="" method="POST">

<select name="behuizingprijs">
<option value="0">tot €50</option>
<option value="50">€50 tot €75</option>
<option value="75">€75 tot €100</option>
<option value="100">€100 tot €150</option>
<option value="150">> €150</option>
</select>

<img name="afbeelding" src="1.gif">

<input type="button" value="<" onclick="javascript:vorigeAfbeelding()">

<select name="behuizing" class="behuizing" onchange="javascript:veranderAfbeelding()">
<option value="10 - DVD-UNSG2 - 29.9900 - Under Siege 2 - Dark Territory - >>>dvd/under_siege2.gif<<<">Under Siege 2 - Dark Territory - 29.9900</option>
</select>

<input type="button" value=">" onclick="javascript:volgendeAfbeelding()">

 

And I get this error from FireBug:

document.behuizing has no properties

var begin = document.behuizing.value.search(/>>>/);

 

I get the same type of error when I click those buttons, so I'm probably doing the same thing wrong a couple of times.

Link to comment
https://forums.phpfreaks.com/topic/101391-solved-object-has-no-properties/
Share on other sites

This works (the original script), but only when I remove the doctype...

<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="author" content="joske">

<title>Untitled 1</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function changeImage()
{
  mainimage.src = list.options[list.selectedIndex].value;
}
function prevImage()
{
if(list.selectedIndex == 0)
{
	list.selectedIndex = list.options.length-1;
}
else
{
	list.selectedIndex--;
}
changeImage();
}
function nextImage()
{
if(list.selectedIndex == list.options.length-1)
{
	list.selectedIndex = 0;
}
else
{
	list.selectedIndex++;
}
changeImage();
}
//  End -->

</script>
</head>

<BODY onLoad="javascript:changeImage()">


<center>

<img name="mainimage" border="1" src="1.gif">
<br>
<input type="button" value="Terug" onclick="javascript:prevImage()">
<select id="list" onchange="javascript:changeImage()">
	<option value="1.gif">Eerste Image</option>
	<option value="2.gif">Tweede Image</option>
	<option value="3.gif">Derde Image</option>

	<option value="4.gif">Vierde Image</option>
	<option value="5.gif">Vijde Image</option>
</select>
<input type="button" value="Volgende" onclick="javascript:nextImage()">
</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.