Visualizzazione dei risultati da 1 a 3 su 3

Discussione: calendario e date

  1. #1

    calendario e date

    Buon pomeriggio a tutti, ho appena messo il calendario per selezionare il giorno e inserire direttamente all'altra pagina.
    quando clicco sul giorno, e nel textfield si inserisce "4/5/2006" ma io vorrei che fosse "04/05/2006". Grazie

    codice:
    <html>
    <head>
    <meta http-equiv="Content-Language" content="es-bo">
    <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Pick a calendar date...</title>
    <SCRIPT language="Javascript">
    
    	function change_cal()
    	{
    		var today = new Date();
    		month=document.cal_form.sel_month.options[document.cal_form.sel_month.options.selectedIndex].value;
    		year=document.cal_form.sel_year.options[document.cal_form.sel_year.options.selectedIndex].value;
    		month_dif=month-(today.getMonth()+1);
    		year_dif=year-today.getYear();
    		url='mc_calendar.asp?sel_month=' + month + '&sel_year=' + year + '&month_dif=' + month_dif
    		 + '&year_dif=' + year_dif + '&date_form=<% =request("date_form") %>'
    		  + '&date_field=<% =request("date_field") %>';
    		window.location=url; 
    	}
    
    	function pick_date(s_day, s_month, s_year)
    	{
    
        	if (window.opener && !window.opener.closed)
    		{
    			//TO CHANGE THE DATE FORMAT JUST CHANGE THE s_month, s_day, s_year variable order
            	window.opener.document.<% =request("date_form") %>.<% =request("date_field") %>.value =s_day + "/" + s_month + "/" + s_year;
        	}
    
        	window.close();
    	
    	}
    	
    
    
    </SCRIPT>
    </head>
    
    <body link="#008000" vlink="#008000" alink="#FF0000" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
    <table border="0" cellpadding="0" style="border-collapse: collapse" id="table3">
      <tr>
        <td>
    <% 	if request("sel_month")<>"" then
    		sel_month=request("sel_month")
    	else
    		sel_month=month(now)
    	end if
    	if request("sel_year")<>"" then
    		sel_year=request("sel_year")
    	else
    		sel_year=year(now)
    	end if
    	if request("month_dif")<>"" then
    		month_dif=cint(request("month_dif"))
    	else
    		month_dif=0
    	end if
    	if request("year_dif")<>"" then
    		year_dif=cint(request("year_dif"))
    	else
    		year_dif=0
    	end if
    
    new_now=DateAdd("m",month_dif,now)	
    new_now=DateAdd("yyyy",year_dif,new_now)	
    response.write("new_now: " & new_now & "
    ")
    first_week_day=WeekDay( new_now- ( day(new_now)-1 )  )
    response.write("first weekday: " & first_week_day & "
    ")
    if first_week_day=1 then
    	date_cursor=-7
    else
    	date_cursor=(first_week_day-1)*-1
    end if
    
    response.write("date cursor: " & date_cursor & "
    ")
    
    first_show_day=day(new_now-(day(new_now)-1)+date_cursor)
    
    response.write("first show day: " & first_show_day & "
    ")
    
     %>
    <table border="3" id="table4" cellspacing="1">
    <form name="cal_form">
      <tr>
        <td colspan="7">
        <div align="left">
          <table border="0" cellpadding="0" style="border-collapse: collapse" id="table5">
            <tr>
              <td>
              <p align="left"><font size="1" face="Arial Narrow">
              <a href="mc_calendar.asp?date_form=<% =request("date_form") %>&date_field=<% =request("date_field") %>">GO
    
              TODAY</a> </font></td>
              <td>
              <p align="right"><font face="Verdana" color="#000080">
    <% response.write(MonthName(sel_month)) %>
    <% response.write(sel_year) %>    
    </font></td>
              <td><font face="Verdana">
        <select size="1" name="sel_month" onChange="javascript: change_cal();">
    <% for i=1 to 12 %>
        <option
        <% if i=cint(sel_month) then %>
        selected
        <% end if %>
     value="<% =i %>"><% response.write(MonthName(i)) %></option>
    <% next %>
        </select></font></td>
              <td><font face="Verdana">
        <select size="1" name="sel_year" onChange="javascript: change_cal();">
    <% for i=1900 to 2100 %>
        <option 
        <% if i=cint(sel_year) then %>
        selected
        <% end if %>
        value="<% =i %>"><% =i %>
        </option>
    <% next %>
        </select></font></td>
            </tr>
          </table>
        </div>
        </td>
      </tr>
      <tr>
        <td align="center"><font face="Verdana" size="1" color="#000080">Domenica</font></td>
        <td align="center"><font face="Verdana" size="1" color="#000080">Lunedì</font></td>
        <td align="center"><font face="Verdana" size="1" color="#000080">Martedì</font></td>
        <td align="center"><font face="Verdana" size="1" color="#000080">
        Mercoledì</font></td>
        <td align="center"><font face="Verdana" size="1" color="#000080">Giovedì</font></td>
        <td align="center"><font face="Verdana" size="1" color="#000080">Venerdì</font></td>
        <td align="center"><font face="Verdana" size="1" color="#000080">Sabato</font></td>
      </tr>
    <% for i=1 to 42 %>
    <% if WeekDay(new_now-(day(new_now)-1)+date_cursor)=1 then 
    	if i>1 then %>
    	  </tr>
    <%	end if %>	
      <tr>
    <% end if %>
        <td>
    <% if (date_cursor>=0 and date_cursor<=2) or (date_cursor>=3 and date_cursor<=30 and day(new_now-(day(new_now)-1)+date_cursor)>3) then %>
          <p align="center">   
             
          <a href="javascript:pick_date('<% =day(new_now-(day(new_now)-1)+date_cursor) %>','<% =sel_month %>','<% =sel_year %>');">   
    <% 		if month(now)=month(new_now) and day(new_now)=day(new_now-(day(new_now)-1)+date_cursor) then	
    	
    	%>		
          <font face="Verdana" size="2" color="#FF0000">
    <% 		else %>
    	<font face="Verdana" size="2" color="#008000">  
    <% 		end if %>
    
          <% response.write( day(new_now-(day(new_now)-1)+date_cursor)     ) %>
          </font>
          </a>
          </p>
    <% elseif date_cursor<0 or date_cursor>=28 then %>
          <font face="Verdana" size="2" color="#C0C0C0">
          <p align="center">   
             
          <% response.write( day(new_now-(day(new_now)-1)+date_cursor)  ) %>
          </p>
          </font>
    <% end if %>
        </td>
        <% date_cursor=date_cursor+1 %>
    <% next %>
    </form>
    </table>
        </td>
      </tr>
      <tr>
        <td>
      </tr>
    </table>
    </body>
    
    </html>
    ..:: GSFLASH ::..
    HTTP://WWW.GSFLASH.IT
    MCTS - ACP - OCP - ECDL
    Ubuntu 7.10/OpenSuse 10.3/Vista Premium/MacOSX Leopard
    My authentic japanese name is 薗田Sonoda (garden field) 大河 Taiga (big river)

  2. #2
    Utente di HTML.it L'avatar di willybit
    Registrato dal
    May 2001
    Messaggi
    4,367
    Ciao gsflash,

    sarebbe stato meglio postare nel forum scripting
    codice:
    	function pick_date(s_day, s_month, s_year)
    	{
    
        	if (window.opener && !window.opener.closed)
    		{
    			//TO CHANGE THE DATE FORMAT JUST CHANGE THE s_month, s_day, s_year variable order
    			s_day='0'+s_day;
    			s_day=s_day.substr(s_day.length-2)
    			s_month='0'+s_month;
    			s_month=s_month.substr(s_month.length-2)
            	window.opener.document.<% =request("date_form") %>.<% =request("date_field") %>.value=s_day + "/" + s_month + "/" + s_year;
        	}
    
        	window.close();
    	
    	}

  3. #3
    Grazie
    Buona serata
    ..:: GSFLASH ::..
    HTTP://WWW.GSFLASH.IT
    MCTS - ACP - OCP - ECDL
    Ubuntu 7.10/OpenSuse 10.3/Vista Premium/MacOSX Leopard
    My authentic japanese name is 薗田Sonoda (garden field) 大河 Taiga (big river)

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.