jnroche Posted October 27, 2006 Share Posted October 27, 2006 Hi Ya olMy php file (myfile.php) includes an html input type tags with button that will 'onclick' to a javascript function. my problem heaps is i get object expected error! this is an excerpt of my file: .....<select name="select" id="reasons"> <?php do { ?> <option value = "<?php echo $reasonrows['txreasonid']; ?> "><?php echo $reasonrows[ 'txreason']; ?></option> <?php } while ($reasonrows = mysql_fetch_array($result)) ?> </select> </div> </form> </td> </tr> <tr> <td height="34"><div align="center"> <input type="button" name="button" value=" Ok " onClick = "writereason();"/>.....THEN somewhere at the bottom of this php file and after the ending php tag (?>) theres my javascript source as shown below:<script language='javascript' type='text/javascript'>function writereason() {alert('bout to request');}</script>THE PROBLEM is i get object expected error. theres not much to the function but i'd like the code to reach this function. -i tried putting this code on top of the file to no avail. -I tried to echo the entire portion of the script to no avail as well.-tried separting it to another "write.js.php" file and including it to this php file using 'include', putting it on top and bottom to no avail.Im not understanding how to call javascript functions from a php file. Please help!!! Link to comment Share on other sites More sharing options...
aspnetguy Posted October 27, 2006 Share Posted October 27, 2006 change onClick to onclick and please post the entire file. Link to comment Share on other sites More sharing options...
jnroche Posted October 30, 2006 Author Share Posted October 30, 2006 thanks for taking tme in answering my question.i have figured out why the problem is showing up. im not calling the the javascript function call where it should be called. thats why it cant find the object.sorry for that. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now