0

Hey guys this is kind of a JavaScript question but the script works elsewhere so I have a feeling it's got something to do with the fact it's being echoed by php. Can anyone tell me why this isn't working:

if (($_SESSION['count'] % 5 == 0) && ($_SESSION['countView'])) { 
          echo 
'<a href="index.php?act=generate_quotes&amp;beginCount&amp;cb=%3C?php%20echo%20time();?%3E" id="logo"  onClick="myinfo"(); return false"></a>';

And the function:

<script type="text/javascript">
<!--
function myinfo() {
window.open( "http://www.google.com/" )
}
//-->
</script>

The href link works fine. But I'm trying to get it to open a info window at the same time. Any reason this isn't working?

Thanks for any help.

3
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by diafol
0

Fixed

echo '<a href="index.php?act=generate_quotes&amp;beginCount&amp;cb='.time().'" id="xavisys-logo" onClick="myinfo(); return false;"></a>';

0

Fixed

echo '<a href="index.php?act=generate_quotes&amp;beginCount&amp;cb='.time().'" id="xavisys-logo" onClick="myinfo(); return false;"></a>';

And interaction between server side language like PHP and client side language like JS is best done via AJAX

0

Urgh - spawning a javascript open window - popup blockers can preventing this. I really would suggest that you avoid this method.

0

Urgh - spawning a javascript open window - popup blockers can preventing this. I really would suggest that you avoid this method.

And best way is to learn AJAX

0

Urgh - spawning a javascript open window - popup blockers can preventing this. I really would suggest that you avoid this method.

Don't get me wrong I'm not trying to use this for advertising. It just seemed the best method I could find for what I wanted to achieve. Would you mind suggesting a more appropriate method?

0

What is it exactly are you trying to achieve?

I would suggest a lightbox - there are literally hundreds out there. jQuery has a few nice ones.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.