Javascript string problem
If I append a string userID value:
interactive.php?userID=EM
...javascript stops working, causing a new window not to open:
However, this works:
interactive.php?userID=99
Do I have to convert the string value in the first case so javascript is able to interpet it?
Thanks,
TonyMontana
druagord posted this at 21:16 — 25th September 2003.
He has: 335 posts
Joined: May 2003
Did you try it in netscape or mozilla with the javascript console this help a lot for javascript errors. if you don't have it post a link or some code
IF , ELSE , WHILE isn't that what life is all about
Suzanne posted this at 22:10 — 25th September 2003.
She has: 5,507 posts
Joined: Feb 2000
I would take it like this, though lord knows I don't do everything the "right" way:
<?php
<script type=\"text/javascript\">
var userID = =$userID;
// rest of your JavaScript
</script>
?>
How are you doing it?
TonyMontana posted this at 02:54 — 26th September 2003.
They have: 218 posts
Joined: Apr 2001
I figured this one out.
Here's the code that didn't work:
<?php
echo \"<a href='javascript:initWindow($userID, 0);'> etc...
?>
And here is a version that does:
<?php
echo \"<a href=\\"javascript:initWindow('$userID', 0);\\"> etc
?>
Those kinds of quote errors are really annoying.
TM
Suzanne posted this at 16:23 — 26th September 2003.
She has: 5,507 posts
Joined: Feb 2000
heh, yeah, they are poopy. hence my use of <?= ?>
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.