|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am adding onMouseOver and onMouseOut for the browser status to some hrefs. These hrefs are already being printed by Javascript due to a Javascript array size that is being checked.
My problem is that the following PHP code causes a Javascript error within the onMouseOut attribute of '': --------------------------------------------- <? $href = "message.php3?UserLoggedIn=$default->UserLoggedIn&mailbox=" . urlencode($mailbox) . "&array_index=$next_index&index=" ; $img = "<img src="$default->graphics_url/next.gif" width="12" height="12" alt="$lang->next" border="0"></a>" ; $img_grey = "<img src="$default->graphics_url/next-grey.gif" width="12" height="12" alt="" border="0">" ; echo "<script language=javascript>n" ; echo " if ($next_index < window.top.sorted.length) {n" ; echo " document.write('<a href="" . $href . "' + window.top.sorted[$next_index] + '">');"; echo " onMouseOver="status='" . $lang->next . "'; return true;" onMouseOut="status='';">n" ; echo " document.write('$img')n" ; echo " } else {n" ; echo " document.write('$img_grey')n" ; echo " }n" ; echo "</script>n" ; ?> --------------------------------------------- I've tried to work this a dozen different ways, but because I'm using a Javascript if,else condition, the variation is limited. (Message cross-posted in the Javascript forum.) Thanks, Bruce |
|
#2
|
|||
|
|||
|
By carefully examining your code, I found that the onMouseOver event is not embedded in the A tag:
echo " document.write('<a href="" . $href . "' + window.top.sorted[$next_index] + '">');"; // <-- premature closing bracket echo " onMouseOver="status='" . $lang->next . "'; return true;" onMouseOut="status='';">n" ; // <-- an extra closing bracket // <-- no </A> ending tag Hope this helps! Peter |
![]() |
| Viewing: Dev Shed Forums > Web Design > JavaScript Development > printing Javascript from PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|