'onmouseover' javascript in .php echo command, is proving troublesome?

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default 'onmouseover' javascript in .php echo command, is proving troublesome?

    Hi,

    Can anyone please tell me what is wrong with this code ?

    I have a 2d Array defined in an included PHP file as follows :-

    /Site #1
    $sitename[0][0]="The Site Name";
    $bannerlocation[0][0]="banners/468x60_2126.gif";
    $bannerdescrition[0][0]="Visit my site!";
    $sitelink[0][0]=http://www.mysite.com;


    In my main PHP file, I have the following line

    echo "<center><a href='".$sitelink[$bantype][$bancode]."'
    onmouseover='status=\"Visit .$sitename[$bantype][$bancode]. \"'; return
    true' onmouseout='status=\" \"; return true'
    target='".$sitename[$bantype][$bancode]."'><img
    src='".$bannerlocation[$bantype][$bancode]."' border='0'
    alt='".$bannerdescription[$bantype][$bancode]."'></a></center><br>";


    This displays the graphic accordingly, and the link also works. HOWEVER,
    when placing the mouse over the banner, instead of saying "Visit The Site
    Name", it says the href link on the status bar instead, as if the
    'onmouseover' javascript never existed ?


    Any help much appreciated.


    Thanks, Mark


    Mark Guest

  2. Similar Questions and Discussions

    1. error in javascript when creating command dialog
      when I create a command dialog as a dreamweaver extension, the "readonly" attribute of either textarea or input are not working. is there any method...
    2. Certificate is Proving Difficult - Help, Please!
      I am using the Certificate template from InDesign... But, it's on 11.5 inch long paper -when I tried to size to 11 inch paper, suddenly there is a...
    3. Echo command option for db2
      -v for echo. In the sample below, the file connect.sql contains connect to sample; C:\tmp>db2 -t -v -f connect.sql connect to sample Database...
    4. how to display variables within using echo command within html code
      this is part of my code question? why the variable $name and $address does not display on the html page instead of real values I do get...
    5. Troublesome listbox
      Can't seem to solve this. The object is to have all linked subforms update while cycling parentmost form. The listbox also needs to update to...
  3. #2

    Default Re: 'onmouseover' javascript in .php echo command, is proving troublesome?

    Mark wrote:
    > Hi,
    >
    > Can anyone please tell me what is wrong with this code ?
    >
    > I have a 2d Array defined in an included PHP file as follows :-
    >
    > /Site #1
    > $sitename[0][0]="The Site Name";
    > $bannerlocation[0][0]="banners/468x60_2126.gif";
    > $bannerdescrition[0][0]="Visit my site!";
    > $sitelink[0][0]=http://www.mysite.com;
    >
    >
    > In my main PHP file, I have the following line
    >
    > echo "<center><a href='".$sitelink[$bantype][$bancode]."'
    > onmouseover='status=\"Visit .$sitename[$bantype][$bancode]. \"'; return
    > true' onmouseout='status=\" \"; return true'
    > target='".$sitename[$bantype][$bancode]."'><img
    > src='".$bannerlocation[$bantype][$bancode]."' border='0'
    > alt='".$bannerdescription[$bantype][$bancode]."'></a></center><br>";
    >
    >
    > This displays the graphic accordingly, and the link also works. HOWEVER,
    > when placing the mouse over the banner, instead of saying "Visit The Site
    > Name", it says the href link on the status bar instead, as if the
    > 'onmouseover' javascript never existed ?
    >
    >
    > Any help much appreciated.
    >
    >
    > Thanks, Mark
    >
    >
    You're missing some quotes ... Did you look at the resulting source ? It
    would have showed you the problem

    Try this:

    echo '<center><a href="' . $sitelink[$bantype][$bancode]. '"
    onmouseover="status=\'Visit ' . $sitename[$bantype][$bancode]. '\';
    return true;" onmouseout="status=\' \'; return true;" target="'
    .. $sitename[$bantype][$bancode] . '"><img src="'
    .. $bannerlocation[$bantype][$bancode] . '" border="0" alt="'
    .. $bannerdescription[$bantype][$bancode] . '"></a></center><br>';
    jrf[no] Guest

  4. #3

    Default Re: 'onmouseover' javascript in .php echo command, is proving troublesome?

    I would not break the line at "return true". Also use onmouseover=" .... "

    This works:

    echo "<center><a href='".$sitelink[$bantype][$bancode]."'
    onmouseover=\"status='Visit ".$sitename[$bantype][$bancode]." '; return
    true\"
    onmouseout='status=\" \"; return true'
    target='".$sitename[$bantype][$bancode]."'><img
    src='".$bannerlocation[$bantype][$bancode]."' border='0'
    alt='".$bannerdescription[$bantype][$bancode]."'></a></center><br>";

    HTH.

    "Mark" <mark_news@horsemad.co.uk> wrote in message
    news:9yfed.254$qj2.253@newsfe6-win.ntli.net...
    > Hi,
    >
    > Can anyone please tell me what is wrong with this code ?
    >
    > I have a 2d Array defined in an included PHP file as follows :-
    >
    > /Site #1
    > $sitename[0][0]="The Site Name";
    > $bannerlocation[0][0]="banners/468x60_2126.gif";
    > $bannerdescrition[0][0]="Visit my site!";
    > $sitelink[0][0]=http://www.mysite.com;
    >
    >
    > In my main PHP file, I have the following line
    >
    > echo "<center><a href='".$sitelink[$bantype][$bancode]."'
    > onmouseover='status=\"Visit .$sitename[$bantype][$bancode]. \"'; return
    > true' onmouseout='status=\" \"; return true'
    > target='".$sitename[$bantype][$bancode]."'><img
    > src='".$bannerlocation[$bantype][$bancode]."' border='0'
    > alt='".$bannerdescription[$bantype][$bancode]."'></a></center><br>";
    >
    >
    > This displays the graphic accordingly, and the link also works. HOWEVER,
    > when placing the mouse over the banner, instead of saying "Visit The Site
    > Name", it says the href link on the status bar instead, as if the
    > 'onmouseover' javascript never existed ?
    >
    >
    > Any help much appreciated.
    >
    >
    > Thanks, Mark
    >
    >

    Duyet The Vo Guest

  5. #4

    Default Re: 'onmouseover' javascript in .php echo command, is proving troublesome?

    Excellent - Thankyou both for your help.


    Thanks, Mark


    Mark Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139