PHP and Javascript
Moderator: General Moderators
PHP and Javascript
Hello. I'm trying to mix some javascript with my php. The below statement contains a line of Javascript that is not opening the PopUp window. Any suggestions on how to recode. Most likely it's a problem with the quotes and the semicolons. Please help.
Sharon
print "<tr>
<td width=9%>$line[date]</td>
<td width=20%>$line[recipient]</td>
<td width=30%>$getline[equipment]</td>
<td width=5%>$line[quantity]</td>
<td width=5%>$line[status]</td>
<font color=#0033CC><td width=4%><a href= updateloan.php?rowid=$line[id]><font color='#0000FF'>Edit</font> </a></td></font>
<td width=5%><a href ' ' =onClick= 'window.open('viewloan.php?rowid=$line[id]', 'View Loan',
'width=370,height=240,status=1'); return false;'><font color='#0000FF'>View</font> </a></td>
</tr>
</table>";
Sharon
print "<tr>
<td width=9%>$line[date]</td>
<td width=20%>$line[recipient]</td>
<td width=30%>$getline[equipment]</td>
<td width=5%>$line[quantity]</td>
<td width=5%>$line[status]</td>
<font color=#0033CC><td width=4%><a href= updateloan.php?rowid=$line[id]><font color='#0000FF'>Edit</font> </a></td></font>
<td width=5%><a href ' ' =onClick= 'window.open('viewloan.php?rowid=$line[id]', 'View Loan',
'width=370,height=240,status=1'); return false;'><font color='#0000FF'>View</font> </a></td>
</tr>
</table>";
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Code: Select all
<?php
print "<tr>
<td width=9%>$line[date]</td>
<td width=20%>$line[recipient]</td>
<td width=30%>$getline[equipment]</td>
<td width=5%>$line[quantity]</td>
<td width=5%>$line[status]</td>
<font color=#0033CC><td width=4%><a href= updateloan.php?rowid=$line[id]><font color='#0000FF'>Edit</font> </a></td></font>
<td width=5%><a href ' ' =onClick= 'window.open('viewloan.php?rowid=$line[id]', 'View Loan',
'width=370,height=240,status=1'); return false;'><font color='#0000FF'>View</font> </a></td>
</tr>
</table>";
?><a href=' ' =onClick ='window.open('viewloan.php?........
Use something like
Code: Select all
<a href='JavaScript:window.open('viewloan.php?rowid=$lineїid]', 'View Loan',
'width=370,height=240,status=1'); return false;'>If you want to open a window in a particular size with javascript I'd do it like this anyway.
Code: Select all
/*Put this in your body and make sure you're between html tags*/
<script>
function openWindow() {
var YourURL="urlcreate.php?name=<?php echo $_GETї'n']; ?>&filenum=<?php echo $_GETї'wap']; ?>"
winpops=window.open(YourURL,"","width=350,height=130,scrollbars=0,")
}
</script>You can change the line that says var YourURL=....
to point to what ever url you wish.
Hope this helps
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
<a href ' ' =onClick= 'window....Code: Select all
<a href='#' onclick='window....-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA