k3Bobos Posted March 10, 2006 Share Posted March 10, 2006 I'm reasonably new to both PHP and Javascript (Microsoft background.......I know, it's my own fault!) but have managed to get my galleries up and running using PHP.Now I want to call a javascript open.window function passing it the image file name and size.All goes well until my image filename has a space in it............. (no, I can't just remove them)I've tried every combination of ' and " and building variables rather than putting it all in-line, to no avail. This is the last attempt before I threw the PC out the window :- $varbuildit= "loc=$base$dir&image=$dirm$imagetext[0]"; $varahref ="javascript:OpenPage('./disp-JS.php?$varbuildit','window1',$width,$height)";need to pass (as an example)javascript:OpenPage('./disp-JS.php?loc=./pics/big/&image=./pics/medium/Hello World.jpg','window1',600,400)What is does is try this :-javascript:OpenPage('./disp-JS.php?loc=./pics/big/&image=./pics/medium/HelloAny pointers would be VERY appreciated!Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/4644-php-and-javascript/ Share on other sites More sharing options...
AndyB Posted March 10, 2006 Share Posted March 10, 2006 replace the spaces in file names (aaaarrrghhh) with their equivalent as far as javascript is concerned %20simple str_replace function in php would handle that before passing the 'new' name to js. Quote Link to comment https://forums.phpfreaks.com/topic/4644-php-and-javascript/#findComment-16258 Share on other sites More sharing options...
txmedic03 Posted March 11, 2006 Share Posted March 11, 2006 [a href=\"http://www.php.net/manual/en/function.urlencode.php\" target=\"_blank\"]This[/a] might help. Quote Link to comment https://forums.phpfreaks.com/topic/4644-php-and-javascript/#findComment-16292 Share on other sites More sharing options...
k3Bobos Posted March 11, 2006 Author Share Posted March 11, 2006 I'll have at these later today (6 year old and 4 month old daughters will take most of the day up!!!) and let you know.Thanks for your help - should have realised that - DOH! :) Quote Link to comment https://forums.phpfreaks.com/topic/4644-php-and-javascript/#findComment-16386 Share on other sites More sharing options...
k3Bobos Posted March 13, 2006 Author Share Posted March 13, 2006 Thanks guys........got there in the end - still harder than I was expecting............ Quote Link to comment https://forums.phpfreaks.com/topic/4644-php-and-javascript/#findComment-17124 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.