Another JavaScript problem
Posted: Mon Nov 18, 2002 9:59 am
Hi (again!)
I have the following code:
which I access through a link, i.e.
But whenever I click on the link I get the following error: "Object Expected" at Line 1, Char. 1. The second part of the filename is retrieved from a database, hence the need to echo $searchcriteria.
I tried changing the code inside the playMedia function to just an alert saying "hello" and I got the same error, so I assume the problem must be elsewhere. My code is:
All the 2 includes contain is a)the title bar - in "playheader.inc.php" and b)the connection info to the database - in "config.inc.php"
Would appreciate any help! Thanks
jonat8[/quote]
I have the following code:
Code: Select all
<SCRIPT LANGUAGE=JavaScript>
function playMedia {
/mediabase/" + <?php echo $searchcriteria?>;
}
</SCRIPT>Code: Select all
<a href="javascript:playMedia()">I tried changing the code inside the playMedia function to just an alert saying "hello" and I got the same error, so I assume the problem must be elsewhere. My code is:
Code: Select all
<? include "playheader.inc.php" ?>
<?php
include "config.inc.php";
$D1 = "filename";
$dbconn = mysql_connect($sServer, "$sUser", "$sPassword");
$result = mysql_select_db($sDB, $dbconn);
if ( $result == false )
{
echo mysql_error();
} else {
$sql = "SELECT * from dalmedia WHERE ".$D1." = '".$searchcriteria."'";
$result = mysql_query( $sql );
if ( $result != false )
{
while ( $data = mysql_fetch_assoc( $result ) )
{
echo ("Record successfully retrieved");
}
} else {
echo ("No filename passed. Please go back and search for another file!");
}
}
?>
<body background="exptextb.jpg">
<a href="javascript:playMedia()"> Play<a>
<center>
<img src="exphorsa.gif" width=300 height=10>
</center>
<SCRIPT LANGUAGE=JavaScript>
function playMedia {
alert("hello")
}
</SCRIPT>Would appreciate any help! Thanks
jonat8[/quote]