Forum Moderators: open

Message Too Old, No Replies

New Window Problem

         

ianru

7:24 pm on Jul 19, 2004 (gmt 0)

10+ Year Member



I have a problem, I need to make a link to go to a new window and that window needs to be customized. I know how to do it in a simple HTML page with Javascript. I can customize teh window size/toolbar and the other parts of the window, now the problem is in here:

echo "<p>";
echo "<a href='profile.php?id=$user_id'>":
echo $username;
echo "</a>";
echo "</p>\n";

If i were to add the javascript to that, i wouldn't have enough quotes to go around for everything, and i really need to figure out how to do this with the same style with just editing the a href with an onClick command.

I'v tried variouse javascrips but none of them seemed to work, after failing to do this I came to here and here I am asking for help.

If anything is unclear at all please ask.

Thx in advance!

coopster

7:30 pm on Jul 19, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, ianru!

If I understand you correctly, you just need to escape the extra quotation marks.

ianru

7:31 pm on Jul 19, 2004 (gmt 0)

10+ Year Member



indeed i do, the problem is, it doesn't seem to escape! Every time i try to escape them, the JS stops working :(

Thx for the welcome

coopster

7:36 pm on Jul 19, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



What language are you scripting in?

ianru

7:37 pm on Jul 19, 2004 (gmt 0)

10+ Year Member



php, forgot to mention that, sorry

encyclo

7:44 pm on Jul 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



echo "<a href='profile.php?id=$user_id'>":

Have you tried something like this?:

echo "<a href=\"profile.php?id=$user_id\" onclick=\"yourFunction('profile.php?id=$user_id','whatever');return false;\">":

You can use double quotes as usual by escaping them with the backslash \ character, and use the single quotes for the Javascript function.

ianru

7:52 pm on Jul 19, 2004 (gmt 0)

10+ Year Member



thanks a lot that fixed my problem!