Page 1 of 1

convert coding (from php to java)

Posted: Sun Apr 10, 2011 3:41 am
by bella1010
i have problem to change the php coding to java script.

i want change this php coding to <script language='javascript'>. How? Below is my php code sentence:

echo "<a href='view_topic.php?id=".$id."'></a>";

then, how to change it to javascript?

change it like sample below:
echo "<script language='javascript'>
alert('Submitted!')
</script><script>window.location='view_topic.php'
</script>";

my problem is i dono how to put ?id=".$id." into javascript. have someone know how to insert ?id=".$id." into my javascript?


or else, change it to another format:
header("Location:view_topic.php");

Re: convert coding (from php to java)

Posted: Sun Apr 10, 2011 9:07 am
by cpetercarter
You do it in exactly the same way as when you echo html to the web page.

Code: Select all

echo "<script language='javascript'>
alert('Submitted!')
</script>
<script>
window.location='view_topic.php?id=$id'
</script>";


Re: convert coding (from php to java)

Posted: Sun Apr 10, 2011 11:09 am
by bella1010
solve it~ thanks~