Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2006
    Location
    South Florida
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Object expected error on dropdown ?

    Hello,

    I am still new to JavaScript and have a simple JavaScript & PHP journal program that allows the user to enter a title and description to be automatically added to a page that list their journal entries.

    Everything works fine except for one part that I am just lost on, at the bottom of the page there is a dropdown menu which lists monthly archives, but when you select any month from the list you get a script error and nothing happens. You are supposed to go to a page that would list al the entries from that month.

    Any help would be greatly appreciated as I do not have the knowledge yet to fix this nor can I find the site that originally created this script.

    Here is the Error I get:

    An Error has occurred in the script of this page

    Line: 100
    Char: 8
    Error: Object expected
    Code: 0
    URL: http://www.kingoftheheel.com/members...al/journal.php


    Here is the code from the page: (I cut out all the HTML so it is shorter)


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <html>
    <head>
    <title>KingOfTheHeel.com - The </title>
    <link rel=stylesheet type=text/css href="styles.css">

    <style type="text/css">

    A:link { color:#ffffcc; }
    A:visited { color:#ffffcc; }
    A:hover { color:red; }
    BODY { FONT-SIZE: 12px; FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;
    SCROLLBAR-BASE-COLOR: #492263;
    SCROLLBAR-ARROW-COLOR: #ffff66; /*
    SCROLLBAR-3DLIGHT-COLOR: #000000;
    SCROLLBAR-HIGHLIGHT-COLOR: #FF9999;
    SCROLLBAR-SHADOW-COLOR: #FF9999;
    SCROLLBAR-DARKSHADOW-COLOR: #660000;
    SCROLLBAR-FACE-COLOR: #ffff66;
    SCROLLBAR-TRACK-COLOR: #000000;*/
    </style>

    </head>

    <body background="../images/stretch.jpg" bgcolor="Black" leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 text="White" link="#ffffcc" vlink="#ffffcc" alink="#ffffcc">

    <?
    include ("common.php");

    MYSQL_CONNECT($hostname,$username,$passwrd) OR DIE("Oh damn! Couldnt connect to the database, sorry mate!");
    @mysql_select_db($dbName) or die("<strong class=black-large>Unable to select database</strong>");

    if ($month)
    { $sortby = " WHERE $maintable.month='" . $month . "' " ;
    $limit = " ";}
    else {$sortby = " "; }

    $query = "
    SELECT $maintable.id, $maintable.thedate, $maintable.topic, $maintable.entry, count($commentstable.id) AS comments
    FROM $maintable
    LEFT OUTER JOIN $commentstable
    ON $maintable.id = $commentstable.id
    $sortby
    GROUP BY $maintable.id
    ORDER BY $maintable.id DESC
    $limit";

    $result = mysql_query($query) or die("<strong class=black-large>Whoops! Something wrong happened to the my database! It would be nice if you emailed <a href=mailto:$webmaster>me</a> and told me!</strong>");

    if ($result) {
    echo "<table border=0 cellspacing=0 cellpadding=5 width=$width align=center>";
    while ($r = mysql_fetch_array($result)) {
    extract($r);
    $entry = nl2br($entry);
    echo "
    <tr bgcolor=492263><td><strong class=black>$topic</strong></td><td align=right><strong class=black>$thedate</strong></td></tr>
    <tr bgcolor=492263><td colspan=2><small class=black-small>$entry</small><br></td></tr>
    <tr bgcolor=492263><td colspan=2><hr color=ffffff size=1 width=100%></td></tr>
    ";
    }
    echo "</table><br>";
    mysql_free_result($result);
    }


    $query2 = "SELECT month FROM $maintable GROUP BY month ORDER BY id";
    $result2 = mysql_query($query2) or die("<strong class=black-large>Whoops! Something wrong happened to the my database! It would be nice if you emailed <a href=mailto:$webmaster>me</a> and told me!</strong>");
    if ($result2) {
    echo "<form><table border=0 cellspacing=0 cellpadding=5 width=$width align=center>
    <td align=right colspan=2 valign=top>
    <select onchange=\"GoUrl(this)\">
    <option> previous journal entries for:
    <option> &nbsp;";
    while ($r2 = mysql_fetch_array($result2)) {
    extract($r2);
    echo "<option value=index.php?month=$month><strong class=black-small> -&gt; &nbsp; $month </strong>";
    }

    echo "</select> </td>
    </tr></table></form> ";
    mysql_free_result($result2);
    }


    mysql_close();
    ?>

    </body>
    </html>


    thanks for any help you have, i am at a loss

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Welcome to the forum.

    We would like o help you, but:
    1. If you post the genuine code with php includes, we will be not able to see what happens, as we can not imagine what kind of elements php application writes on your page. We need the final HTML picure, as it is to be seen when View Source.

    2. Your link is untouchable (My FireFox says that there is no page at your posted URL. Anyway, post an URL only when you feel that it absolutelly necessary to do that. Try to isolate the javascript problem, and post it here, not the entire huge page...

    and 3. (I might be wrong)... For the moment I see no touch of a javascript code in your post...
    Last edited by Kor; 01-21-2006 at 03:56 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •