homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Image call script by using onclick
script, connect, php

 8:09 pm on Nov 6, 2013 (gmt 0)

I have a form where you have to inset a date.Im using a script that can auto fill the form with a choosen date.

The form looks like this:

<input type="text" value="<?=date('Ymd');?>" id="from" id="<?php echo $_REQUEST["from"]; ?>" name="displaydate">

<?=date('Ymd');?> just show the date of today. If you want to use anyother date you can click on the form and a "drop-down" calendar is showed. Its the code: <?php echo $_REQUEST["from"]; ?> that call the script. The script looks like:

$(function() {
var dates = $( "#from, #to" ).datepicker({
changeMonth: true,
numberOfMonths: 2,
dateFormat: 'yy-mm-dd',
onSelect: function( selectedDate ) {
var option = this.id == "from" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" ),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
selectedDate, instance.settings );
dates.not( this ).datepicker( "option", option, date );

Now what I need help to, is that I would like to place a small calendar image beside the form. When you click the small image the calendar also "drop-down" just as when you click on the form. I have tried with the code:
<img src='images/calendar.png' onclick="from" style='cursor: pointer; vertical-align: middle;' /> but that dont help. Any suggestions?



 11:01 pm on Nov 11, 2013 (gmt 0)

Don't reinvent the wheel, use jQuery instead ;)


 3:29 pm on Nov 12, 2013 (gmt 0)


Please Try This

<img src='images/calendar.png' id="show_cal" style='cursor: pointer; vertical-align: middle;' />



 6:39 pm on Nov 12, 2013 (gmt 0)

Oh, you are using jQuery... lol... oops, my bad! I didn't even look at the JS, because I was in PHP mode.

I don't have time to dig through the jQuery you have right now, but I'll try to remember to come back to this one later on.


 8:15 pm on Nov 13, 2013 (gmt 0)

You could alternativley look into using the CSS :after pseudo class, which if memory serves has been around long enough to not really need to worry about compatability issues with older browsers.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved