Jump to content

Archived

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

AV1611

Javascript error - But program runs fine...

Recommended Posts

First, let me say, I am NOT a JS person... I only use it when I can't do something with html/php/perl/css

That being said, I have a script with a cool slider that I like better than a pulldown... I hacked it from a generic slider script I found here several months ago...

It works fin, but it does give an error

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Line: 381
Char: 2
Error: 'this.input' is null or not an object
Code: 0
[/quote]

Here is the script, There are not 381 lines... so I don't know what line that is...
I won't snip anything, as I don't know what you need to see...[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--
<link type="text/css" rel="StyleSheet" href="css/winclassic.css" />
-->
<style type="text/css">
body {
font:MessageBox;
font:Message-Box;
}
input {
width:50px;
text-align:right;
padding:1px;
margin-right:15px;
}
input, select, button {
vertical-align:middle;
}
#slider-1 {
margin:10px;
width:350px;
}
#slider-2 {
margin:10px;
}

</style>
<script type="text/javascript">
//<![CDATA[

function getQueryString( sProp ) {
var re = new RegExp( sProp + "=([^\\&]*)", "i" );
var a = re.exec( document.location.search );
if ( a == null )
return "";
return a[1];
};

function changeCssFile( sCssFile ) {
var loc = String(document.location);
var search = document.location.search;
if ( search != "" )
loc = loc.replace( search, "" );
loc = loc + "?css=" + sCssFile;
document.location.replace( loc );
}

var cssFile = getQueryString( "css" );
if ( cssFile == "" )
cssFile = "css/bluecurve/bluecurve.css";

document.write("<link type=\"text/css\" rel=\"StyleSheet\" href=\"" + cssFile + "\" />" );

//]]>
</script>
<!--
<link type="text/css" rel="StyleSheet" href="css/winclassic.css" />
-->

<?php
// ******************************* PHP for CHAPTER ******************************************
  $user="";
  $host="localhost";
  $password="";
  $database = "bible";
  mysql_connect($host,$user,$password);
  mysql_select_db($database);
  $BOOK=$_POST['BOOK'];
  $SELECT="SELECT";
  IF ($SELECT == $BOOK)

  {echo "<meta HTTP-EQUIV='refresh' CONTENT='0;URL=bibleformbook.php'>";}
  ELSE
  {}
  echo '<form name="chapter" value="chapter" method="POST" action="AUDIOPLAY.PHP">';
  $result = mysql_query
  ("
  SELECT count(`CHAPTER`) as COUNT FROM BIBLEMP3LIST where `BOOK` like '$BOOK' ORDER BY `KEY`
  ");
  IF ($row=mysql_fetch_array($result))
  {do
  {
  $COUNT=$row["COUNT"];

  }
  while($row = mysql_fetch_array($result));
  echo "<center></SELECT>
  ";
  }
  ELSE
  {
  print "CHAPTER NOT FOUND";
}
// ****************************************************************
?>

<script type="text/javascript">

function Range() {
this._value = 0;
this._minimum = 1;
this._maximum = <?php echo $COUNT ?>;
this._extent = 0;

this._isChanging = false;
}

Range.prototype.setValue = function (value) {
value = parseInt(value);
if (isNaN(value)) return;
if (this._value != value) {
if (value + this._extent > this._maximum)
this._value = this._maximum - this._extent;
else if (value < this._minimum)
this._value = this._minimum;
else
this._value = value;
if (!this._isChanging && typeof this.onchange == "function")
this.onchange();
}
};

Range.prototype.getValue = function () {
return this._value;
};

Range.prototype.setExtent = function (extent) {
if (this._extent != extent) {
if (extent < 0)
this._extent = 0;
else if (this._value + extent > this._maximum)
this._extent = this._maximum - this._value;
else
this._extent = extent;
if (!this._isChanging && typeof this.onchange == "function")
this.onchange();
}
};

Range.prototype.getExtent = function () {
return this._extent;
};

Range.prototype.setMinimum = function (minimum) {
if (this._minimum != minimum) {
var oldIsChanging = this._isChanging;
this._isChanging = true;

this._minimum = minimum;

if (minimum > this._value)
this.setValue(minimum);
if (minimum > this._maximum) {
this._extent = 0;
this.setMaximum(minimum);
this.setValue(minimum)
}
if (minimum + this._extent > this._maximum)
this._extent = this._maximum - this._minimum;

this._isChanging = oldIsChanging;
if (!this._isChanging && typeof this.onchange == "function")
this.onchange();
}
};

Range.prototype.getMinimum = function () {
return this._minimum;
};

Range.prototype.setMaximum = function (maximum) {
if (this._maximum != maximum) {
var oldIsChanging = this._isChanging;
this._isChanging = true;

this._maximum = maximum;

if (maximum < this._value)
this.setValue(maximum - this._extent);
if (maximum < this._minimum) {
this._extent = 0;
this.setMinimum(maximum);
this.setValue(this._maximum);
}
if (maximum < this._minimum + this._extent)
this._extent = this._maximum - this._minimum;
if (maximum < this._value + this._extent)
this._extent = this._maximum - this._value;

this._isChanging = oldIsChanging;
if (!this._isChanging && typeof this.onchange == "function")
this.onchange();
}
};
Range.prototype.getMaximum = function () {
return this._maximum;
};
</script>
<script type="text/javascript" src="js/timer.js"></script>
<script type="text/javascript" src="js/slider.js"></script>
</head>
<body>

</div>

<table border="1"><tr align="middle"><td colspan="4"><b><?php echo $BOOK;?></b></td></tr>
<tr><td colspan="4"><div class="slider" id="slider-1" tabIndex="1"></td></tr>


<tr align="middle"><td><B>Chapter:</b></td>
<td> <input SIZE="4" name="CHAPTER" id="h-value" onchange="s.setValue(parseInt(this.value))"/></td>

<script type="text/javascript">

var s = new Slider(document.getElementById("slider-1"));


s.onchange = function () {
document.getElementById("h-value").value = s.getValue();

};
s.setValue(1);

window.onresize = function () {
s.recalculate();
};


</script>
<input type = "hidden" name="BOOK" value="<?php echo $BOOK; ?>">
<td>
<input style="color: #000000;
   background: #c0c0c0;
   text-decoration: none;
   width: 40px;
   height:20px;
   font-size: 85%;
   text-align: center;" type="submit" name="Submit" value="PLAY"></td><td>
</form>
<FORM>
<input style="color: #000000;
   background: #c0c0c0;
   text-decoration: none;
   width: 40px;
   height:20px;
   font-size: 85%;
   text-align: center;" type="button" value="BACK" onClick="history.go(-1);return true;">
</td></tr></table></form>
</body>
</html>

[/code]

Share this post


Link to post
Share on other sites
not exactly sure what the problem is, but i know javascript loves to complaint about stupid stuff
[code]<td> <input SIZE="4" name="CHAPTER" id="h-value" onchange="s.setValue(parseInt(this.value))"/></td>[/code]

this input is missing a type attribute. try to put it back. see what happens.

Share this post


Link to post
Share on other sites

×

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.