almystersv Posted February 9, 2008 Share Posted February 9, 2008 Hi Guys, I am creating a page on my website that allows people to book a meeting room. I have a small calendar for them to select a date and at the moment have a drop down box that allows them to select an hour time slot between 9-5. What I would like to happen is that once the user has selected a date an image will appear showing the hourly time slots for that day, in green if they are available or red if they are not. I image I would have to use a number of If statements to show the green box if time not selected and red if date is already selected. How do I get an image to appear once the user has selected the date?? Is this approach possible or am I being to adventurous?! Any advice or help before i get started on this would be brilliant. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/90275-image-to-appear-onclick/ Share on other sites More sharing options...
ratcateme Posted February 9, 2008 Share Posted February 9, 2008 you could use javascript to show the image like this <span id="pic1"></span> <script> function loadpic(){ document.getElementById('pic1').innerHTML='<img src="image.php" />'; } </script Scott. Quote Link to comment https://forums.phpfreaks.com/topic/90275-image-to-appear-onclick/#findComment-462843 Share on other sites More sharing options...
almystersv Posted February 9, 2008 Author Share Posted February 9, 2008 Hi Thanks for replying. What triggers the image to appear in that code?? I want the image to appear when the user selects a date. Quote Link to comment https://forums.phpfreaks.com/topic/90275-image-to-appear-onclick/#findComment-462848 Share on other sites More sharing options...
ratcateme Posted February 9, 2008 Share Posted February 9, 2008 you have a select tag if you add this to your select tag onchange="loadpic()" this will show your image Scott. Quote Link to comment https://forums.phpfreaks.com/topic/90275-image-to-appear-onclick/#findComment-462853 Share on other sites More sharing options...
almystersv Posted February 9, 2008 Author Share Posted February 9, 2008 Hi, Is there any way of setting the onchange="loadpic()" function in my calendar which is javascript. Here is my code <script>DateInput('bkgDate', true, 'YYYY-MM-DD')</script> Quote Link to comment https://forums.phpfreaks.com/topic/90275-image-to-appear-onclick/#findComment-462909 Share on other sites More sharing options...
PHP Monkeh Posted February 9, 2008 Share Posted February 9, 2008 I think a bit more info would help. How are the users selecting the date? Select menu? Clicking a table cell? Clicking a link? Give us more! Also this should be moved to JavaScript Help. Quote Link to comment https://forums.phpfreaks.com/topic/90275-image-to-appear-onclick/#findComment-462920 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.