PDA

View Full Version : javascript popup with php


mr e
08-18-2002, 10:18 PM
ok basically the popup just doesn't come up, i copied most of the javascript from beta.vbulletin.com/vb3 (sad huh) and changed the variables and stuff to work for my site, but all i get when i click the link is a javascript error, the ! in a yellow triangle in the bottom left corner of IE, so here is my code...

echo '<script type="text/javascript">'
.'<!--'
.'function ip(id) {'
.'window.open("index.php?action=ippopup&id="+id,"toolbar=no,location=no,menubar=no,scrollbars=no,wi dth=100,height=50,resizeable=no,status=no");'
.'}'
.'// -->'
.'</script>';

and here is what i call it with

<a href=\"javascript:ip($id)\">[IP]</a>


so any ideas on why it wont work? thanks :D

edit: there IS a \ in front of the "javascript:ip($id) but for some reason it isn't there in the post

Ajay
08-19-2002, 12:39 AM
why do you have it in PHP? why not just have it in normal html and echo the variables

<script type="text/javascript">
<!-- <? function ip(id) { ?>
window.open("index.php action=ippopup&id="+id,"toolbar=no,location=no,menubar=no,scrollbars=no,wi dth=10 0,height=50,resizeable=no,status=no")
<? } ?>
// -->
</script>

<a href="java script:<? echo "ip(id)";?>><?echo "[$IP]";?></a>

mr e
08-19-2002, 12:46 AM
because it's inside of php script, and i just need help on the java part

Ajay
08-19-2002, 12:56 AM
<? if ($blah) { ?>
<script type="text/javascript">
<!-- <? function ip(id) { ?>
window.open("index.php action=ippopup&id="+id,"toolbar=no,location=no,menubar=no,scrollbars=no,wi dth=10 0,height=50,resizeable=no,status=no")
<? } ?>
// -->
</script>

<a href="java script:<? echo "ip(id)";?>><?echo "[$IP]";?></a>
<? }
continue the script ?>

mr e
08-19-2002, 01:41 AM
the function ip(id) isn't php, it's javascript, but maybe that way could work...hrmmm...

*goes off to try again*