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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

puting PHP variable with in javascript

Status
Not open for further replies.

inusrat

Programmer
Feb 28, 2004
308
CA
Is it possible to put php variable with in javascript

I have a php variable
$longstring="cmd=_cart&upload=1&business=irfan_n34@yahoo.com&no_note=1¤cy_code=CAD&lc=CA&custom=isheikh&invoice=b06c166e9070fa8e685382d055d274c2";

I want it to add this to the URL below in javascript function, can I do that ?

function doPopup() {
URL = "width = 370; // width of window in pixels
height = 308; // height of window in pixels
delay = 10; // time in seconds before popup opens
timer = setTimeout("Start(url, width, height)", delay*1000);
}

 
thanks . i am using following code to open new window of 800/600. But I do not get any horizontal or vertical scroll bar. Do you know how can I put the scroll bars, so i do not miss bottom and right part of the page ........

<script language="JavaScript">

URL = " echo $longstring ?>";

closetime = 20; // Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds

width = 800; // width of window in pixels
height = 600; // height of window in pixels
delay = 0; // time in seconds before popup opens


<!-- Begin

function Start(URL, WIDTH, HEIGHT) {
windowprops = "left=1,top=1,width=" + WIDTH + ",height=" + HEIGHT;
preview = window.open(URL, "preview", windowprops);
if (closetime) setTimeout("preview.close();", closetime*1000);
}

timer = setTimeout("Start(url, width, height)", delay*1000);



</script>

 
Use:

windowprops = "left=1,top=1,width=" + WIDTH + ",height=" + HEIGHT + 'scrollbars=yes,toolbar=yes';

If you don't use any window parameters, then the new window will open normally. You can use preview.moveTo and preview.resizeTo to place it where you want then.

Lee
 
I put the code that you mentioned but it will not put the scroll bar either vertical or horzontal...

function Start(URL, WIDTH, HEIGHT) {
windowprops = "left=1,top=1,width=" + WIDTH + ",height=" + HEIGHT + 'scrollbars= yes,toolbar=yes';
preview = window.open(URL, "preview", windowprops);
if (closetime) setTimeout("preview.close();", closetime*1000);
}



 
I missed a comma. You should check things yourself, too, and catch simple mistakes like that:

windowprops = "left=1,top=1,width=" + WIDTH + ",height=" + HEIGHT + ',scrollbars=yes,toolbar=yes';

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top