I am trying to hide a URL onMouseOver within PHP. I keep getting runtime errors. I have tried many things, but nothing works. All I want to do is hide my URL on mouseovers. The information is stored in a MySQL database.
Here's what it looks like
----the javascript-----
<script language="JavaScript">
function displayStatusMsg(msgStr) {
status=msgStr;
document.returnValue = true;
}
</script>
-----the variable------
$msgs=$row["name"];
-----the echo statement-----
echo "<a href='$link' onMouseOver='displayStatusMsg($msgs)';return document.returnValue>"."Click Here"."</a>";
PHP and javascript
Moderator: General Moderators
-
Bennettman
- Forum Contributor
- Posts: 130
- Joined: Sat Jun 15, 2002 3:58 pm
Use a normal link:
<a href="page.html" onMouseOver="window.status='text'; return true">
where text is what you want to appear in the status bar. If you just want it to appear blank, put this in:
<a href="page.html" onMouseOver="window.status=''; return true">
If that was in PHP, it would be a simple print/echo command.
<a href="page.html" onMouseOver="window.status='text'; return true">
where text is what you want to appear in the status bar. If you just want it to appear blank, put this in:
<a href="page.html" onMouseOver="window.status=''; return true">
If that was in PHP, it would be a simple print/echo command.
Re: PHP and javascript
Don't forget that when you're echoing the variables it's going to print out whatever is in teh variable. So what sending the text as a parameter to the javascript you'll need to encase it in quotes, such as:BuzzT wrote: echo "<a href='$link' onMouseOver='displayStatusMsg($msgs)';return document.returnValue>"."Click Here"."</a>";
Code: Select all
echo "<a href="$link" onMouseOver="displayStatusMsg('$msgs'); return document.returnValue">Click Here</a>";