SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Newbie Help

  1. #1
    Free me php klassicd's Avatar
    Join Date
    Sep 2001
    Location
    San Diego
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Newbie Help

    Is there anything wrong with this? IM trying to do a messge board smile box kinda like at sitepoint but keep getting errors. Its somewhere in this code.
    function 1() {
    document.board.message.focus();
    document.board.message.value = document.board.message.value+\"?\";
    }
    function 2() {
    document.board.message.focus();
    document.board.message.value = document.board.message.value+\"\";
    }
    function 3() {
    document.board.message.focus();
    document.board.message.value = document.board.message.value+\"\";
    }
    function 4() {
    document.board.message.focus();
    document.board.message.value = document.board.message.value+\"\";
    }
    function 5() {
    document.board.message.focus();
    document.board.message.value = document.board.message.value+\":P\";
    }
    function 6() {
    document.board.message.focus();
    document.board.message.value = document.board.message.value+\"8-)\";
    }


    The \ is for exscaping the " in php.
    Last edited by klassicd; Apr 5, 2002 at 22:10.

  2. #2
    ********* obeah makeda's Avatar
    Join Date
    Jun 2001
    Location
    rollin' on dubs
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem that I see is that you're trying to concatenate a string but you're escaping the quotation marks that you need for the string. I think that instead of this:

    document.board.message.value + \":P\";


    You should either be doing this:
    Code:
    document.board.message.value + "\":P\"";
    or this:
    Code:
    document.board.message.value + ":P";

    Otherwise, its looking for a variable that is undefined. See if either of those help.

  3. #3
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    urm i think that your going about this completely the wrong way with all them functions.

    why not store each image in an array

    use one function

    PHP Code:

    function smilies(val)
    {
    var 
    smilie = new Array();

    smilie[0] = ':)';
    smilie[1] = ';)';
    smilie[2] = ':p';
    smilie[3] = ':o';
    smilie[4] = ':d';
    smilie[5] = '(s)';

    if (
    val>smilie.length || val<|| val == nullalert('number less than\nnumber greater than\nor null');

        
    document.board.message;

        
    x.focus(); 
        
    x.value x.value smilie[val]; 




Bookmarks

Posting Permissions

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