I have a text input search form for support tickets. If the user inputs a ticket id (checked using a PHP if statement), the background color of the search box is changed to yellow (using a PHP echo) to highlight the search text entered. This part works.
I would like to also change the source value of an iframe as part of the PHP if condition like this:
<td align="left">
<input type="text" name="ticket" id="ticket" placeholder="Ticket" value="<?php echo $this->state->ticket;?>" class="input-mini search-query" onchange="document.adminForm.submit();"
<?php if ($this->state->ticket != "")
{
echo 'style="background-color: yellow;"';
echo '<script language="javascript">';
echo 'document.getElementById("ticketIframe").contentWindow.document.location.href="http://myurl.com"';
echo '</script>';
}?>/>
</td>
The javascript function (document.getElementById...) displays on the page rather than executing. I tried a simple javascript alert, but got the same result.
Suggestions?
>