I'm trying to get a link to appear which opens a set sized window using window.open in javascript.
I am just having NO luck in getting it to work.
At first I tried putting it into the script - didnt work, I then put it in an html file and included() it into the php script and that worked. However I need a php variable to be used in this script so the js MUST be embedded into php rather than flat html which is the only way i have got it working so far.
This is my code, any help would be greatly appreciated. Cheers.
<script language="JavaScript">
<!--
function stadium(url)
{
stadium_win = window.open(url,"plain","width=500,height=250,scrollbars=yes");
}
// -->
</script>
<?
$playerid = $_GET['$playerid'];
echo '<a href=http://www.htmlforums.com/archive/index.php/"#" onClick="javascript:stadium('comments.php&pid=$playerid');"><img
src=http://www.htmlforums.com/archive/index.php/"i/top_tds.gif" width="68" height="20" border="0"></a>';
?>so let me guess, you get a parse error on the link line?
well this is one of those times you can't use the single quote.
<?
$playerid = $_GET['$playerid'];
echo "<a href=http://www.htmlforums.com/archive/index.php/\"#\" onclick=\"java script:stadium('comments.php&pid=$playerid');\"><img
src=http://www.htmlforums.com/archive/index.php/\"i/top_tds.gif\" width=\"68\" height=\"20\" border=\"0\"></a>";
?>
and you can stick you script in the head section.I'll give it a try thanks mate.Doesnt seem to be working mate, the parse error is gone, but the script function isnt working. Remember I dont have control over the head section as it will be a script the user includes into their site design.make sure you take the space out of javascript.
also try this.
<?
$playerid = $_GET['$playerid'];
echo "<a href=http://www.htmlforums.com/archive/index.php/\"#\" onclick=\"window.open('comments.php&pid=$playerid','plain','width=500,height=250,scrollbars=yes');\"><img
src=http://www.htmlforums.com/archive/index.php/\"i/top_tds.gif\" width=\"68\" height=\"20\" border=\"0\"></a>";
?>I love ya I love ya, thanks mate. Thats been troubling me all bloody day. Sure takes out the hassle of the java script function..
Thats worked a treat, thanks again.no prob
I am just having NO luck in getting it to work.
At first I tried putting it into the script - didnt work, I then put it in an html file and included() it into the php script and that worked. However I need a php variable to be used in this script so the js MUST be embedded into php rather than flat html which is the only way i have got it working so far.
This is my code, any help would be greatly appreciated. Cheers.
<script language="JavaScript">
<!--
function stadium(url)
{
stadium_win = window.open(url,"plain","width=500,height=250,scrollbars=yes");
}
// -->
</script>
<?
$playerid = $_GET['$playerid'];
echo '<a href=http://www.htmlforums.com/archive/index.php/"#" onClick="javascript:stadium('comments.php&pid=$playerid');"><img
src=http://www.htmlforums.com/archive/index.php/"i/top_tds.gif" width="68" height="20" border="0"></a>';
?>so let me guess, you get a parse error on the link line?
well this is one of those times you can't use the single quote.
<?
$playerid = $_GET['$playerid'];
echo "<a href=http://www.htmlforums.com/archive/index.php/\"#\" onclick=\"java script:stadium('comments.php&pid=$playerid');\"><img
src=http://www.htmlforums.com/archive/index.php/\"i/top_tds.gif\" width=\"68\" height=\"20\" border=\"0\"></a>";
?>
and you can stick you script in the head section.I'll give it a try thanks mate.Doesnt seem to be working mate, the parse error is gone, but the script function isnt working. Remember I dont have control over the head section as it will be a script the user includes into their site design.make sure you take the space out of javascript.
also try this.
<?
$playerid = $_GET['$playerid'];
echo "<a href=http://www.htmlforums.com/archive/index.php/\"#\" onclick=\"window.open('comments.php&pid=$playerid','plain','width=500,height=250,scrollbars=yes');\"><img
src=http://www.htmlforums.com/archive/index.php/\"i/top_tds.gif\" width=\"68\" height=\"20\" border=\"0\"></a>";
?>I love ya I love ya, thanks mate. Thats been troubling me all bloody day. Sure takes out the hassle of the java script function..
Thats worked a treat, thanks again.no prob