Pavlos1316
Members-
Posts
302 -
Joined
-
Last visited
Everything posted by Pavlos1316
-
Nope... I get: NaN The only thing I can think is that cause I am taking the server time, for some reason the script takes the server format also and doesn't accept anything else... (can this be possible...?)
-
That's what I've been reading all day What is there that I don't get? I want the date to be displayed Mon, June 13th 2009 00:00:00 What am I not see?
-
Good mornig, Font problem I fixed it... Now I am trying to find out why I cannot change the date format. What ever I do I always get the same format... Monday, 13 June, 2009 00:00:00 (in red is where I am trying to format my date) Plus I want to move the time to the next line. Any help? (I re-enter the javascript code only) <script type="text/javascript"> var weekdaystxt=["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] function showLocalTime(container, servermode, offsetMinutes, displayversion){ if (!document.getElementById || !document.getElementById(container)) return this.container=document.getElementById(container) this.displayversion=displayversion var servertimestring=(servermode=="server-php")? '<? print date ("D dS F Y H:i:s", time())?>' : (servermode=="server-ssi")? '<!--#config timefmt=" %a, %d %B %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->' : '<%= Now() %>' this.localtime=this.serverdate=new Date(servertimestring) this.localtime.setTime(this.serverdate.getTime()+offsetMinutes*60*1000) //add user offset to server time this.updateTime() this.updateContainer() } showLocalTime.prototype.updateTime=function(){ var thisobj=this this.localtime.setSeconds(this.localtime.getSeconds()+1) setTimeout(function(){thisobj.updateTime()}, 1000) //update time every second } showLocalTime.prototype.updateContainer=function(){ var thisobj=this if (this.displayversion=="long") this.container.innerHTML=this.localtime.toLocaleString() else{ var hour=this.localtime.getHours() var minutes=this.localtime.getMinutes() var seconds=this.localtime.getSeconds() var dayofweek=weekdaystxt[this.localtime.getDay()] this.container.innerHTML=formatField(hour, 1)+":"+formatField(minutes)+":"+formatField(seconds)+" "+"("+dayofweek+")" } setTimeout(function(){thisobj.updateContainer()}, 1000) //update container every second } function formatField(num, isHour){ if (typeof isHour!="undefined"){ //if this is the hour field var hour=(num>24)? num-24 : num return (hour==0)? 24 : hour } return (num<=9)? "0"+num : num//if this is minute or sec field } </script>
-
Hello all, I have this code for date and time and it works great, but because I don't know much about javascript I cannot customize some things like font-color. (this is my only code with javascript in my web site) Tell me if you can help. <!-- body { margin-left: 0px; margin-top: 0px; background-color: #FF0000; margin-right: 0px; margin-bottom: 200px; background-image: url(); } .style1 { font-size: 18px } .style2 { font-size: 18px; color: #FF0000; } .style3 { font-color: #000000; } --> </style> <script type="text/javascript"> var weekdaystxt=["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] function showLocalTime(container, servermode, offsetMinutes, displayversion){ if (!document.getElementById || !document.getElementById(container)) return this.container=document.getElementById(container) this.displayversion=displayversion var servertimestring=(servermode=="server-php")? '<? print date ("D dS F Y H:i:s", time())?>' : (servermode=="server-ssi")? '<!--#config timefmt=" %a, %d %B %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->' : '<%= Now() %>' this.localtime=this.serverdate=new Date(servertimestring) this.localtime.setTime(this.serverdate.getTime()+offsetMinutes*60*1000) //add user offset to server time this.updateTime() this.updateContainer() } showLocalTime.prototype.updateTime=function(){ var thisobj=this this.localtime.setSeconds(this.localtime.getSeconds()+1) setTimeout(function(){thisobj.updateTime()}, 1000) //update time every second } showLocalTime.prototype.updateContainer=function(){ var thisobj=this if (this.displayversion=="long") this.container.innerHTML=this.localtime.toLocaleString() else{ var hour=this.localtime.getHours() var minutes=this.localtime.getMinutes() var seconds=this.localtime.getSeconds() var dayofweek=weekdaystxt[this.localtime.getDay()] this.container.innerHTML=formatField(hour, 1)+":"+formatField(minutes)+":"+formatField(seconds)+" "+"("+dayofweek+")" } setTimeout(function(){thisobj.updateContainer()}, 1000) //update container every second } function formatField(num, isHour){ if (typeof isHour!="undefined"){ //if this is the hour field var hour=(num>24)? num-24 : num return (hour==0)? 24 : hour } return (num<=9)? "0"+num : num//if this is minute or sec field } </script> </head> <body> <table width="100%" border="0" align="center"> <tr> <th scope="col" width="230</th><div class="style3"><span id="timebox"></span></div> <script type="text/javascript"> new showLocalTime("timebox", "server-php", 420, "long") </script><div></div> </tr> </table> </body> </html> The problems... 1. How do I customize the time and date font color, style & size? (what ever I do is not working! most likely cause I don't know what I am doing with javascript ) 2. In the column where time and date is displayed I want to be displayed in 2 lines instead of one... ex 1/2/2009 00:00:00 not 1/2/2009 00:00:00 3. I want to see a 24h time and not 12h without showing AM or PM. ex 00:00:00 not 1:9:36 PM Thank you
-
sorry... found it
-
oh... Thank you. Is been a while since my last login and it seems I can't find the javascript help forum... I thought it was kicked out. Where can I find it?
-
Hello all, I have this script for display date and time <?php $hourdiff = "2"; // hours diff btwn server and local time $melbdate = date("l, d F Y h:i:s",time() + ($hourdiff * 3600)); print ("$melbdate"); ?> but I need it to update time every second (not only when I refresh the page...) Can anyone help? Thank you
-
Hello to all, I don't know if is the right place to write here but I hope you can help. I need to know the basics to create an internet game, like Tribal Wars lets say. (I have to say that the only expirience that I have is creating web sites using php) Is there some one tat can help me a bit? Thank you
-
Sorry... Here is my full script. If i Leave it for 12 hour format is ok. If I try 24 hour the time is not displayed! <script type="text/javascript"> var weekdaystxt=["Sun", "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat"] function showLocalTime(container, servermode, offsetMinutes, displayversion){ if (!document.getElementById || !document.getElementById(container)) return this.container=document.getElementById(container) this.displayversion=displayversion var servertimestring=(servermode=="server-php")? '<? print date("F d, Y H:i:s", time())?>' : (servermode=="server-ssi")? '<!--#config timefmt="%B %d, %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->' : '<%= Now() %>' this.localtime=this.serverdate=new Date(servertimestring) this.localtime.setTime(this.serverdate.getTime()+offsetMinutes*60*1000) //add user offset to server time this.updateTime() this.updateContainer() } showLocalTime.prototype.updateTime=function(){ var thisobj=this this.localtime.setSeconds(this.localtime.getSeconds()+1) setTimeout(function(){thisobj.updateTime()}, 1000) //update time every second } showLocalTime.prototype.updateContainer=function(){ var thisobj=this if (this.displayversion=="long") this.container.innerHTML=this.localtime.toLocaleString() else{ var hour=this.localtime.getHours() var minutes=this.localtime.getMinutes() var seconds=this.localtime.getSeconds() var ampm=(hour>=12)? "PM" : "AM" var dayofweek=weekdaystxt[this.localtime.getDay()] this.container.innerHTML=formatField(hour, 1)+":"+formatField(minutes)+":"+formatField(seconds)+" "+ampm+" ("+dayofweek+")" } setTimeout(function(){thisobj.updateContainer()}, 1000) //update container every second } function formatField(num, isHour){ if (typeof isHour!="undefined"){ //if this is the hour field var hour=(num>12)? num-12 : num return (hour==0)? 12 : hour } return (num<=9)? "0"+num : num//if this is minute or sec field } </script>
-
Hello everyone I have this script (part of it) for 12hour format. function formatField(num, isHour){ if (typeof isHour!="undefined"){ //if this is the hour field var hour=(num>12)? num-12 : num return (hour==0) {hour = 24;} } return (num<=9)? "0"+num : num//if this is minute or sec field } How do i change it for 24hour format? Thank you
-
hi all is there a way to display the time and date that I want, lets say: Mon 13th of July 2008 00:00:00 GMT+2 my difficulty is to leave study the GMT+2 I don't want to show local time. Thanks
-
Hi all I have the below javascript for time&date. It works fine but it gets the pc's time&date to display. What do I have to modify so it will display always my desired time&date (GMT+2)? /////////////// CONFIGURATION ///////////////////////////// // Set the clock's font face: var myfont_face = "Verdana"; // Set the clock's font size (in point): var myfont_size = "10"; // Set the clock's font color: var myfont_color = "#00FFFF"; // Set the clock's background color: var myback_color = "#000000"; // Set the text to display before the clock: var mypre_text = ""; // Set the width of the clock (in pixels): var mywidth = 300; // Display the time in 24 or 12 hour time? // 0 = 24, 1 = 12 var my12_hour = 0; // How often do you want the clock updated? // 0 = Never, 1 = Every Second, 2 = Every Minute // If you pick 0 or 2, the seconds will not be displayed var myupdate = 1; // Display the date? // 0 = No, 1 = Yes var DisplayDate = 1; /////////////// END CONFIGURATION ///////////////////////// /////////////////////////////////////////////////////////// // Browser detect code var ie4=document.all var ns4=document.layers var ns6=document.getElementById&&!document.all // Global varibale definitions: var dn = ""; var mn = "th"; var old = ""; // The following arrays contain data which is used in the clock's // date function. Feel free to change values for Days and Months // if needed (if you wanted abbreviated names for example). var DaysOfWeek = new Array(7); DaysOfWeek[0] = "Sun"; DaysOfWeek[1] = "Mon"; DaysOfWeek[2] = "Tue"; DaysOfWeek[3] = "Wed"; DaysOfWeek[4] = "Thu"; DaysOfWeek[5] = "Fri"; DaysOfWeek[6] = "Sat"; var MonthsOfYear = new Array(12); MonthsOfYear[0] = "January"; MonthsOfYear[1] = "February"; MonthsOfYear[2] = "March"; MonthsOfYear[3] = "April"; MonthsOfYear[4] = "May"; MonthsOfYear[5] = "June"; MonthsOfYear[6] = "July"; MonthsOfYear[7] = "August"; MonthsOfYear[8] = "September"; MonthsOfYear[9] = "October"; MonthsOfYear[10] = "November"; MonthsOfYear[11] = "December"; // This array controls how often the clock is updated, // based on your selection in the configuration. var ClockUpdate = new Array(3); ClockUpdate[0] = 0; ClockUpdate[1] = 1000; ClockUpdate[2] = 60000; // For Version 4+ browsers, write the appropriate HTML to the // page for the clock, otherwise, attempt to write a static // date to the page. if (ie4||ns6) { document.write('<span id="LiveClockIE" style="width:'+mywidth+'px; background-color:'+myback_color+'"></span>'); } else if (document.layers) { document.write('<ilayer bgColor="'+myback_color+'" id="ClockPosNS" visibility="hide"><layer width="'+mywidth+'" id="LiveClockNS"></layer></ilayer>'); } else { old = "true"; show_clock(); } // The main part of the script: function show_clock() { if (old == "die") { return; } //show clock in NS 4 if (ns4) document.ClockPosNS.visibility="show" // Get all our date variables: var Digital = new Date(); var day = Digital.getDay(); var mday = Digital.getDate(); var month = Digital.getMonth(); var hours = Digital.getHours(); var minutes = Digital.getMinutes(); var seconds = Digital.getSeconds(); // Fix the "mn" variable if needed: if (mday == 1) { mn = "st"; } else if (mday == 2) { mn = "nd"; } else if (mday == 3) { mn = "rd"; } else if (mday == 21) { mn = "st"; } else if (mday == 22) { mn = "nd"; } else if (mday == 23) { mn = "rd"; } else if (mday == 31) { mn = "st"; } // Set up the hours for either 24 or 12 hour display: if (my12_hour) { dn = "AM"; if (hours > 12) { dn = "PM"; hours = hours - 12; } if (hours == 0) { hours = 12; } } else { dn = ""; } if (minutes <= 9) { minutes = "0"+minutes; } if (seconds <= 9) { seconds = "0"+seconds; } // This is the actual HTML of the clock. If you're going to play around // with this, be careful to keep all your quotations in tact. myclock = ''; myclock += '<font style="color:'+myfont_color+'; font-family:'+myfont_face+'; font-size:'+myfont_size+'pt;">'; myclock += mypre_text; myclock += hours+':'+minutes; if ((myupdate < 2) || (myupdate == 0)) { myclock += ':'+seconds; } myclock += ' '+dn; if (DisplayDate) { myclock +=DaysOfWeek[day]+', '+mday+mn+' '+MonthsOfYear[month]; } myclock += '</font>'; if (old == "true") { document.write(myclock); old = "die"; return; } // Write the clock to the layer: if (ns4) { clockpos = document.ClockPosNS; liveclock = clockpos.document.LiveClockNS; liveclock.document.write(myclock); liveclock.document.close(); } else if (ie4) { LiveClockIE.innerHTML = myclock; } else if (ns6){ document.getElementById("LiveClockIE").innerHTML = myclock; } if (myupdate != 0) { setTimeout("show_clock()",ClockUpdate[myupdate]); } } Thanks in advance
-
date&time.php was ex name but that file includes time & date function. and i want to call it in a column inside my top.html....... if possible. Cannot change top.html cause then I have to change a lot of things. Exept if there is an easy php script to display my own time and date in real time. Oh and <?php include ("");?> doesn't work!!!
-
Hi all I have this column code (from my table): <th scope="col" width="250"><emptyempty> </th> and I want to call (where emptyempty is) my date&time.php. Any ideas how to do that?
-
Hi all.. I was given this code to display a msg the first time a user logs in. <?php if (!$_SESSION['firsttime']) { echo "<center><font size=10><font color=#00FFFF><font weight=bold>Welcome</font></font></font></center>"; $_SESSION['firsttime'] = true; } ?> Everything is working exept the <font size>. What ever I do is not changing. Any ideas why?
-
Here is the full code.. I see it.. in my page ex I open www.mysite.com and I see: Name: [mytextfieldhere] /> <body> <table width="914" border="0" align="center"> <tr> <th scope="col"><form action="register.php" method="post" enctype="application/x-www-form-urlencoded" name="register" id="register"> <div align="center"> <div align="left"> <pre><span class="style71"> Full Name:</span> <input name="Full_Name" type="text" id="Full_Name" size="50" maxlength="19" <?php if (isset($_POST['Full_Name'])) { echo 'value="'.$_POST['Full_Name'].'"'; } ?> /><span class="style71"> Birthday: </span><input name="Birthday" type="text" id="Birthday" size="12" maxlength="10" <?php if(isset($_POST['Birthday'])) { echo 'value="'.$_POST['Birthday'].'"'; } ?>/> <span class="style75"> accounts</span> <span class="style69"> (dd-mm-yyyy)</span> <span class="style71">Mail:</span> <input name="Mail" type="text" size="89" maxlength="77" id="Mail" <?php if (isset($_POST['Mail'])) { echo 'value="'.$_POST['Mail'].'"'; } ?>/> <span class="style75">with false statements</span> <span class="style69"> (Street-Street No-Territory-Postal Code-Town-Country)</span> <span class="style71">E-mail:</span> <input name="E_Mail" type="text" size="30" maxlength="30" id="E_Mail" <?php if (isset($_POST['E_Mail'])) { echo 'value="'.$_POST['E_Mail'].'"'; } ?>/> <span class="style71">Phone No:</span> <input name="Phone_No" type="text" id="Phone_No" size="25" maxlength="19" <?php if (isset($_POST['Phone_No'])) { echo 'value="'.$_POST['Phone_No'].'"'; } ?>/> <span class="style75"> will be deleted</span></pre> <pre> <span class="style71">Username: </span><input name="Username" type="text" size="30" maxlength="10" id="Username" <?php if (isset($_POST['Username'])) { echo 'value="'.$_POST['Username'].'"'; } ?>/> <span class="style71">Password:</span> <input name="Password" type="password" size="25" maxlength="10" id="Password" <?php if (isset($_POST['Password'])) { echo 'value="'.$_POST['Password'].'"'; } ?>/> <span class="style75"> automatically!!!</span></pre> </div> </div> <div align="left"> <pre><span class="style75"> By submitting this form you agree to accept all <a href="terms and conditions.html" target="_new">Terms and Conditions</a></span> <input name="Submit" type="submit" id="button" onclick="this.form.post" value="Submit" /></pre> </div> </form></th> </tr> </table> </body> </html
-
<pre><span class="style71"> Full Name:</span> <input name="Full_Name" type="text" id="Full_Name" size="50" maxlength="19" <?php if (isset($_POST['Full_Name'])) { echo 'value="'.$_POST['Full_Name'].'"'; } ?> /><span class="style71"> Birthday: </span><input name="Birthday" type="text" id="Birthday" size="12" maxlength="10" <?php if(isset($_POST['Birthday'])) { echo 'value="'.$_POST['Birthday'].'"'; } ?>/> <span class="style75"> accounts</span>
-
Ok here we go again... <input name="Full_Name" type="text" id="Full_Name" size="50" maxlength="19" <?php if (isset($_POST['Full_Name'])) { echo 'value="'.$_POST['Full_Name'].'"'; } ?>/> This is working fine (leaving enter data in place if submition fails) BUT in my register page i see the /> after my textfield. ex. Name: textfield /> Any ideas how or what to fix?
-
[SOLVED] Don't loose insert data upon submition fail
Pavlos1316 replied to Pavlos1316's topic in PHP Coding Help
THIS THREAD WAS SOLVED IN REPLY No 16. IGNORE REPLIES No 17 & 18 CAUSE WHENEVER i ASK SOMETHING ELSE IN A TREAD NEVER GET SOLVED THANKS -
THIS DID WHAT I WANTED... if ((empty($FieldName) + empty($FieldName2) + empty($FieldName3) + empty($FieldName4) + empty($FieldName5) + empty($FieldName6)) > 1){ include....; echo...; exit(); COUNT IF MORE THAN 2 FIELDS ARE EMPTY. SORRY IF I DIDN'T EXPLAINED IT CORRECT. THANKS FOR HELPING