Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I use PHP vars within Javascript code ??? 1

Status
Not open for further replies.

grwd

Technical User
Jan 20, 2002
20
0
0
US
In my PHP code:
I have a var:
$server = 'How I do I use that var in the following JavaScript so that I don't have to hard code the server ip in it?

-----------------snip----------------------------
<script LANGUAGE=&quot;JavaScript&quot;><!--

function OpnWindSize(w,h) {
var Ooooorl = &quot; var WinTitle = &quot;'&quot; + w + &quot;x&quot; + h + &quot;'&quot;;
var WinParams = &quot;'toolbar=no,status=no,scrollbars=no,menubar=no,&quot;
WinParams += &quot;directories=no,location=no,resizable=yes,width=&quot; + w ;
WinParams += &quot;,height=&quot; + h + &quot;'&quot;;
if (Ooooorl.value == &quot;&quot; || Ooooorl.value == &quot; enter a URL to open...&quot;);Ooooorl.focus();Ooooorl.select();return}
window.open(&quot; null, WinParams);
}
// -->
-------------------snip-------------------
 
Hi,

You do it like this:

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
function OpnWindSize(w,h) {
var Ooooorl = &quot;<?php echo $server; ?>/cvvPopUp.html&quot;;
}
//-->
</script>

That is the format you should use to input the variable in.

Hope this helps!

relax.gif


Keep up to date with my 2003 NHL Playoffs Wallpaper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top