JavaScript - [resolve] Run Time : 0.046385049819946 At Linux Firefox
I have an message RUN TIME : 0.046385049819946 at linux firefox.
The script is used for menu system at top and left side. PHP Code: var frm = document.mainsearch; var bar_bool = false; var body_bool = false; var select_text = document.getElementById("select_text"); var text_tbl = document.getElementById("text_tbl"); var open_tbl = document.getElementById("open_tbl"); var bar = document.getElementById("open_bar"); var line_color = "#dddddd"; var roll_color = "#7fbb37"; var roll_font_color = "#ffffff"; function open_select() { if (bar_bool == false) { bar.style.display = "block"; bar_bool = true; body_bool = true; } else { close_bar(); } } function close_bar() { if (bar_bool == true) { bar.style.display = "none"; bar_bool = false; body_bool = false; } } function select_menu (group_id,group_subject,num) { select_text.innerHTML = group_subject; frm.gr_id.value = group_id; close_bar(); } bar.width = open_tbl.width; tds = bar.getElementsByTagName("td"); for (i=0; i<tds.length; i++) { tds[i].width = open_tbl.width; tds[i].onmouseover = function() { this.style.cursor = "hand"; this.style.cursor = "pointer"; this.style.backgroundColor = roll_color; this.style.color = roll_font_color; } tds[i].onmouseout = function() { this.style.backgroundColor = ""; this.style.color = ""; } } function fsearch_check() { partten = /[ /}{"[,.~<>!@#$%^&*()\-=+_']/gi; frm.stx.value = frm.stx.value.replace(partten,""); if (!frm.stx.value) { alert("query here"); return; } frm.action = g4_path + "/bbs/search.php"; frm.submit(); } document.body.onclick = function() { if (body_bool == false) { close_bar(); } else { open_select(); } } How can I solve this problem? Any helpful comment wuld be appreciated. Similar TutorialsHi all, New to the forum. I have downloaded a template off template monster and am currently in the process of modifying it to suit my needs. I am currently working on the contact page which has a form and appears to be working fine however I have yet to receive an e-mail once the form is submitted. The forms uses Javascript (forms.js) and a MailHandler.php file. I cant understand what is going wrong as everything seems to be working but perhaps im missing the obvious - You can view the page on http://zoeandeddie.webspace.virginme...m/index-4.html Below is the content of the two files - ive replaced my actual email address with 'myemail@address.com: forms.js Code: ;(function($){ $.fn.forms=function(o){ return this.each(function(){ var th=$(this) ,_=th.data('forms')||{ errorCl:'error', emptyCl:'empty', invalidCl:'invalid', notRequiredCl:'notRequired', successCl:'success', successShow:'4000', mailHandlerURL:'bin/MailHandler.php', ownerEmail:'myemail@address.com', stripHTML:true, smtpMailServer:'localhost', targets:'input,textarea', controls:'a[data-type=reset],a[data-type=submit]', validate:true, rx:{ ".name":{rx:/^[a-zA-Z'][a-zA-Z-' ]+[a-zA-Z']?$/,target:'input'}, ".state":{rx:/^[a-zA-Z'][a-zA-Z-' ]+[a-zA-Z']?$/,target:'input'}, ".email":{rx:/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i,target:'input'}, ".phone":{rx:/^\+?(\d[\d\-\+\(\) ]{5,}\d$)/,target:'input'}, ".fax":{rx:/^\+?(\d[\d\-\+\(\) ]{5,}\d$)/,target:'input'}, ".message":{rx:/.{20}/,target:'textarea'} }, preFu:function(){ _.labels.each(function(){ var label=$(this), inp=$(_.targets,this), defVal=inp.val(), trueVal=(function(){ var tmp=inp.is('input')?(tmp=label.html().match(/value=['"](.+?)['"].+/),!!tmp&&!!tmp[1]&&tmp[1]):inp.html() return defVal==''?defVal:tmp })() trueVal!=defVal &&inp.val(defVal=trueVal||defVal) label.data({defVal:defVal}) inp .bind('focus',function(){ inp.val()==defVal &&(inp.val(''),_.hideEmptyFu(label),label.removeClass(_.invalidCl)) }) .bind('blur',function(){ _.validateFu(label) if(_.isEmpty(label)) inp.val(defVal) ,_.hideErrorFu(label.removeClass(_.invalidCl)) }) .bind('keyup',function(){ label.hasClass(_.invalidCl) &&_.validateFu(label) }) label.find('.'+_.errorCl+',.'+_.emptyCl).css({display:'block'}).hide() }) _.success=$('.'+_.successCl,_.form).hide() }, isRequired:function(el){ return !el.hasClass(_.notRequiredCl) }, isValid:function(el){ var ret=true $.each(_.rx,function(k,d){ if(el.is(k)) ret=d.rx.test(el.find(d.target).val()) }) return ret }, isEmpty:function(el){ var tmp return (tmp=el.find(_.targets).val())==''||tmp==el.data('defVal') }, validateFu:function(el){ el.each(function(){ var th=$(this) ,req=_.isRequired(th) ,empty=_.isEmpty(th) ,valid=_.isValid(th) if(empty&&req) _.showEmptyFu(th.addClass(_.invalidCl)) else _.hideEmptyFu(th.removeClass(_.invalidCl)) if(!empty) if(valid) _.hideErrorFu(th.removeClass(_.invalidCl)) else _.showErrorFu(th.addClass(_.invalidCl)) }) }, getValFromLabel:function(label){ var val=$('input,textarea',label).val() ,defVal=label.data('defVal') return label.length?val==defVal?'nope':val:'nope' } ,submitFu:function(){ _.validateFu(_.labels) if(!_.form.has('.'+_.invalidCl).length) $.ajax({ type: "POST", url:_.mailHandlerURL, data:{ name:_.getValFromLabel($('.name',_.form)), email:_.getValFromLabel($('.email',_.form)), phone:_.getValFromLabel($('.phone',_.form)), fax:_.getValFromLabel($('.fax',_.form)), state:_.getValFromLabel($('.state',_.form)), message:_.getValFromLabel($('.message',_.form)), owner_email:_.ownerEmail, stripHTML:_.stripHTML }, success: function(){ _.showFu() } }) }, showFu:function(){ _.success.slideDown(function(){ setTimeout(function(){ _.success.slideUp() _.form.trigger('reset') },_.successShow) }) }, controlsFu:function(){ $(_.controls,_.form).each(function(){ var th=$(this) th .bind('click',function(){ _.form.trigger(th.data('type')) return false }) }) }, showErrorFu:function(label){ label.find('.'+_.errorCl).slideDown() }, hideErrorFu:function(label){ label.find('.'+_.errorCl).slideUp() }, showEmptyFu:function(label){ label.find('.'+_.emptyCl).slideDown() _.hideErrorFu(label) }, hideEmptyFu:function(label){ label.find('.'+_.emptyCl).slideUp() }, init:function(){ _.form=_.me _.labels=$('label',_.form) _.preFu() _.controlsFu() _.form .bind('submit',function(){ if(_.validate) _.submitFu() else _.form[0].submit() return false }) .bind('reset',function(){ _.labels.removeClass(_.invalidCl) _.labels.each(function(){ var th=$(this) _.hideErrorFu(th) _.hideEmptyFu(th) }) }) _.form.trigger('reset') } } _.me||_.init(_.me=th.data({forms:_})) typeof o=='object' &&$.extend(_,o) }) } })(jQuery) $(function(){ $('#contact-form').forms({ ownerEmail:'myemail@address.com' }) }) MailHandler.php Code: <?php $owner_email = $_POST["owner_email"]; $headers = 'From:' . $_POST["email"]; $subject = 'A message from your site visitor ' . $_POST["name"]; $messageBody = ""; if($_POST['name']!='nope'){ $messageBody .= '<p>Visitor: ' . $_POST["name"] . '</p>' . "\n"; $messageBody .= '<br>' . "\n"; } if($_POST['email']!='nope'){ $messageBody .= '<p>Email Address: ' . $_POST['email'] . '</p>' . "\n"; $messageBody .= '<br>' . "\n"; }else{ $headers = ''; } if($_POST['state']!='nope'){ $messageBody .= '<p>State: ' . $_POST['state'] . '</p>' . "\n"; $messageBody .= '<br>' . "\n"; } if($_POST['phone']!='nope'){ $messageBody .= '<p>Phone Number: ' . $_POST['phone'] . '</p>' . "\n"; $messageBody .= '<br>' . "\n"; } if($_POST['fax']!='nope'){ $messageBody .= '<p>Fax Number: ' . $_POST['fax'] . '</p>' . "\n"; $messageBody .= '<br>' . "\n"; } if($_POST['message']!='nope'){ $messageBody .= '<p>Message: ' . $_POST['message'] . '</p>' . "\n"; } if($_POST["stripHTML"] == 'true'){ $messageBody = strip_tags($messageBody); } try{ if(!mail($owner_email, $subject, $messageBody, $headers)){ throw new Exception('mail failed'); }else{ echo 'mail sent'; } }catch(Exception $e){ echo $e->getMessage() ."\n"; } ?> This is my first time posting, so please let me know if I am doing things as expected. When users click on a "Was this helpful?" link, an e-mail message displays with the page title (accomplished using a JS function). I want to put this is an external file so that it only needs to be updated once. Here's the code in the feedback.js file: Code: function feedback() { mail_str = "mailto:feedback@company?subject=Page Title: " + document.title; mail_str += "&body=Thank you for your input."; location.href = mail_str; } And here's the code in the page: Code: <script src="feedback.js" type="text/javascript"></script> ... Was this topic <a href="javascript:feedback()">helpful?</a> When I do this, an "object expected" error displays. When I put the code inside of the header, it works fine. What gives? Hi, Using a while loop in a function, I am trying to test an input character against a stored string of characters. I want the function to return the input character only if it is not in the stored string of characters. The code I've prepared is as follows: Code: <SCRIPT language = "JavaScript"> var storedLetters = 'sideways'; function requestLetters(aString) { var validLetter =''; var inputLetter = window.prompt('Please input a single lower-case letter', ''); while (storedLetters.indexOf(inputLetter) != -1) { inputLetter = window.prompt('You have already tried ' + inputLetter + ' . Please try another' + ' letter.'); } validLetter = inputLetter; return validLetter; } requestLetters(storedLetters); document.write(validLetter); </SCRIPT> The code works fine if I remove it from the function wrapper but if the function is called I keep getting an error message that the variable validLetter is not defined. Can anyone see why this is the case? Thanks. Hi, I have written a function to compare each character in startString with another nominated character (nomChar). If they are the same this character is written to outputString, in the same position. If they are not the same a character is lifted from the same position in altString and placed in the same position in outputString instead. I hope that's clear! Code as follows: Code: function compareChar(startString, altString, nomChar) { var outputString = ''; outputString.length = startString.length; var nextLetter = ''; for (var count = 0; count < startString.length; count = count + 1) { nextLetter = startString.charAt(count); if (nextLetter == nomChar) { outputString.charAt(count) = nextLetter; } else { outputString.charAt(count) = altString.charAt(count); } } } document.write(compareChar('boston', 'denver' , 'o' ) ); However, the line of code within the if statement Code: outputString.charAt(count) = nextLetter; keeps generating an 'Invalid assigment left hand side' error message. Can anyone see why this is the case? Thanks. hi im using dhtml xgrid where i need to do validation for time ,(from-time and to-time i.e ind==1 and ind==2 ) to-time must be greater than from-time else i need to alert a message to-time must be greater than from-time. can any one send me the code for it time format is[05:00]. Code: var err_str=""; function validate_grid(value,id,ind) { $("#result").html(" ").show(); if(ind==1 || ind==2) { var patt=/^([0][0-9]|[1][0-9]|[2][0-3])[:]{1}[0-5][0-9]$/; if(!patt.test(value)) { mygrid.setCellTextStyle(id,ind,"background-color:yellow;"); if(err_str!="") err_str+="\n"+(ind+1)+".Enter numbers and : only.."; else err_str=(ind+1)+".Enter numbers and : only"; return false; } else { mygrid.setCellTextStyle(id,ind,"background-color:white;"); return true; } } } Hello im using dhtmlx grid in this cells i have from time and to time (i.e ind==1 and ind==2) i need to validate time where to-time must be greater than from-time else it should alert an message,i have writeen a normal Regular expression for the time validation.as the time is i string format i.e[05:00],please can any one send me code for that. Code: var err_str=""; function validate_grid(value,id,ind) { if(ind==1 || ind==2) { var patt=/^([0][0-9]|[1][0-9]|[2][0-3])[:]{1}[0-5][0-9]$/; if(!patt.test(value)) { mygrid.setCellTextStyle(id,ind,"background-color:yellow;"); if(err_str!="") err_str+="\n"+(ind+1)+".Enter numbers and : only.."; else err_str=(ind+1)+".Enter numbers and : only"; return false; } else { mygrid.setCellTextStyle(id,ind,"background-color:white;"); return true; } } } Hi Code: var err_str=""; function validate_grid(value,id,ind) { $("#result").html(" ").show(); if(ind==1 || ind==2) { var patt=/^([0][0-9]|[1][0-9]|[2][0-3])[:]{1}[0-5][0-9]$/; if(!patt.test(value)) { mygrid.setCellTextStyle(id,ind,"background-color:yellow;"); if(err_str!="") err_str+="\n"+(ind+1)+".Enter numbers and : only.."; else err_str=(ind+1)+".Enter numbers and : only"; return false; } else { mygrid.setCellTextStyle(id,ind,"background-color:white;"); return true; } } } alert(err-str); here ind==1 is from_time and ind==2 is to_time,i need to validate time as to_time must be always greater than from-time,if condition fails an alert msg should populate.time format is[05:00]as it is in string format im unable to do the validation for it.(ex:from-time=08:00 to-time=07:59 condition fails) thank you. I have been using Perl code for about 15 years and I develop/support Perl code used by engineers who run this code in Linux terminals. The code uses Tk as the user interface, which in turn executes Perl scripts. We are looking into the possibility of putting the user interface in a web browser, which would (somehow) still run the same scripts on a Linux box. I can write a Perl script that, given a Linux machine name, user name and password, can open a connection to that machine and execute anything on that machine. My question: Can this sort of thing be done via a web page? This is posted in the JS forum because JS seems like it would provide the tools to create the type of interactive user interface I require. (I don't know a thing about JS, at the moment I'm trying to decide which language to use to implement my s/w, but first I need to determine if the language can do what I need.) On http://kisa.ca/cc/ I'm using JQuery's .keydown() to grab arrow keys. http://pastie.org/938572 But my friends using Linux are unable to use arrows to play the game: http://alteeve.com/files/cc.png Halp? 1 down vote favorite I do have the countdown script (see link below) to display the time between current time and the date given in real-time. However, I want to achieve to display the time difference between a given start and end time. Right now, it calculates from the current server time to the end time. I want to be able to set up my own start time and end time. Here is what I have: http://jsfiddle.net/BgEtE/ thank you for help hi, can some one help me how to get the time and date difference? given two time and date with the following format like in textbox A: 2011-05-03 17:35:47.0 and textbox B: 2011-05-03 16:35:47.0 then the output would be: 0 days, 1 hour, 0 minutes, 0 seconds regards, verve I'm not really a Java writer, so I don't know how to do this myself, though I imagine it would be pretty simple. I am looking to add a script to a webpage that allows users to input a time manually, and have it converted to GMT/Zulu time and display the converted time. I have seen a lot of time zone conversion scripts online, but they all just convert whatever the current system time is to another time zone. I am looking for a script that allows users to convert a time and show the zulu time, for times other than the current time. The time zone the inputed local time would be in is +4:30 (Kabul). I don't really care about style or aestehtics, just a simple script I can insert into a web page to have a time input field. The converted output time can appear in another field, a popup bubble, etc, again style isn't really an issue. It's really just to help people in my job who need to know what the GMT/Zulu time was for certain local times after the fact. One would think it shouldn't be that hard to just subtract 4:30 in your head, but apparently it is. Sorry if just asking for code outright like this is frowned upon. This is my first time doing JavaScript I don't what I did wrong here, but the problem its not showing up the current date and time. Code: <script language = "JavaScript" type="text/javascript"> now = new Date(); localtime = now.toString(); utctime = now.GMTString(); document.wite("<b>localtime</b>" + localtime + "</br>"); document.write("<b>utctime</b>" + utctime); </script> This is what supposed to look like I have tried using different browser chrome,IE9,Maxtor, and Opera my OS is Win7 Hi - I have a date in my javascript like this: Mon Dec 12 00:00:00 UTC+0430 2011 I need to convert it to a date without the offset (the +0430). I actually changed my computer's timezone to generate this offset - we have uses placing orders on our site who don't use UTC and it's throwing our orders out as they need to select a delivery date but it's passing the date with the offset. How do I convert a date to UTC time? Thanks Hi there! Well, I recently found the Image clock code, and I am loving it! But, I would like it to only display pacific time, not retrieve the time from a users browser. Here's my code: Code: <script type="text/javascript"> /*********************************************** * JavaScript Image Clock- by JavaScript Kit (www.javascriptkit.com) * This notice must stay intact for usage * Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more ***********************************************/ var imageclock=new Object() //Enter path to clock digit images here, in order of 0-9, then "am/pm", then colon image: imageclock.digits=["/users/1712/49/18/66/album/c012.png", "/users/1712/49/18/66/album/c112.png", "/users/1712/49/18/66/album/c211.png", "/users/1712/49/18/66/album/c311.png", "/users/1712/49/18/66/album/c411.png", "/users/1712/49/18/66/album/c511.png", "/users/1712/49/18/66/album/c611.png", "/users/1712/49/18/66/album/c711.png", "/users/1712/49/18/66/album/c811.png", "/users/1712/49/18/66/album/c911.png", "/users/1712/49/18/66/album/cam11.png", "/users/1712/49/18/66/album/cpm13.png", "/users/1712/49/18/66/album/ccolon11.png"] imageclock.instances=0 var preloadimages=[] for (var i=0; i<imageclock.digits.length; i++){ //preload images preloadimages[i]=new Image() preloadimages[i].src=imageclock.digits[i] } imageclock.imageHTML=function(timestring){ //return timestring (ie: 1:56:38) into string of images instead var sections=timestring.split(":") if (sections[0]=="0") //If hour field is 0 (aka 12 AM) sections[0]="12" else if (sections[0]>=13) sections[0]=sections[0]-12+"" for (var i=0; i<sections.length; i++){ if (sections[i].length==1) sections[i]='<img src="'+imageclock.digits[0]+'" />'+'<img src="'+imageclock.digits[parseInt(sections[i])]+'" />' else sections[i]='<img src="'+imageclock.digits[parseInt(sections[i].charAt(0))]+'" />'+'<img src="'+imageclock.digits[parseInt(sections[i].charAt(1))]+'" />' } return sections[0]+'<img src="'+imageclock.digits[12]+'" />'+sections[1]+'<img src="'+imageclock.digits[12]+'" />'+sections[2] } imageclock.display=function(){ var clockinstance=this this.spanid="clockspan"+(imageclock.instances++) document.write('<span id="'+this.spanid+'"></span>') this.update() setInterval(function(){clockinstance.update()}, 1000) } imageclock.display.prototype.update=function(){ var dateobj=new Date() var currenttime=dateobj.getHours()+":"+dateobj.getMinutes()+":"+dateobj.getSeconds() //create time string var currenttimeHTML=imageclock.imageHTML(currenttime)+'<img src="'+((dateobj.getHours()>=12)? imageclock.digits[11] : imageclock.digits[10])+'" />' document.getElementById(this.spanid).innerHTML=currenttimeHTML } </script> <DIV STYLE="position:absolute; top:260px; left:215px; width:109px; height:28px"> <FONT SIZE="+2" COLOR="black"> <TABLE BORDER="0" cellpadding="10" CELLSPACING="0" TOP MARGIN="0"> <TR> <TD WIDTH="109" HEIGHT="28" BACKGROUND="/users/1712/49/18/66/album/clock210.png" VALIGN="top"> <script type="text/javascript"> new imageclock.display() </script> </TD> </TR> </TABLE> </DIV> Much appreciated! Hi brothers and sisters, My first post here. I am trying to do a self-test system for my small company, everything is going smoothly so far however, I am facing some problem with setting a cut off time for doing the test. For example, my staff could not go in to the system after 8pm. Anyone had any idea on how to do it?? I have only some basic knowledge of php which I learn in school thus setting time limit might be too advance for me thus need you guys help. Thank alot Hi, I have very little JS knowledge, on a scale of 1 - 10 I would give me a 1, so apologies if I have this completely backwards. AIM: I have a form that takes in times a person was doing an activity, and you can enter multiple times & activities in one go. e.g. Person A | Lunch | 12:00 - 13:00 | Meeting | 13:30 - 14:00 I need the JS to validate that Activity B (Meeting in the above example) does not overlap with Activity A (Lunch in the above example). It also needs to check this for all activity's so that none overlap with each other else output error. I have managed to do this server side in PHP and will include the code as it may help show what I am trying to do better than Im explaining. PHP Code Code: $Code = $_POST['code']; $NumberofCodes = count($Code); $Start = array(); $_POST['starthr'] = array_values($_POST['starthr']); $_POST['startmin'] = array_values($_POST['startmin']); $i = 0; foreach($_POST['starthr'] as $key1 => $value1) { $Start[(int)$i] = $_POST['starthr'][$key1] .":". $_POST['startmin'][$key1]; $i++; } $Stop = array(); $_POST['stophr'] = array_values($_POST['stophr']); $_POST['stopmin'] = array_values($_POST['stopmin']); $i = 0; foreach($_POST['stophr'] as $key1 => $value1) { $Stop[(int)$i] = $_POST['stophr'][$key1] .":". $_POST['stopmin'][$key1]; $i++; } $i = 0; $j = 1; while ($i < $NumberofCodes){ while(($j-1) < $NumberofCodes){ if (($Start[$j] > $Start[$i] && $Start[$j] < $Stop[$i]) || ($Stop[$j] > $Start[$i] && $Stop[$j] <= $Stop[$i])) { //Stop form executing and provide error information. } $j++; } $i++; } JS Code (What I could manage) Code: var i = 0; var j = 1; var Start = new Array(); var Stop = new Array(); var aa = new Array(); var bb = new Array(); while (i < counter){ while((j-1) < counter){ Start[i] = document.myform.elements('starthr['+i+']').value + ":" + document.myform.elements('startmin['+i+']').value; Stop[i] = document.myform.elements('stophr['+i+']').value + ":" + document.myform.elements('stopmin['+i+']').value; var a = toDate(Start[i],"h:m") var b = toDate(Stop[i],"h:m") aa[i] = a; bb[i] = b; function toDate(dStr,format) { var now = new Date(); now.setHours(dStr.substr(0,dStr.indexOf(":"))); now.setMinutes(dStr.substr(dStr.indexOf(":")+1)); now.setSeconds(0); return now; } if ((aa[j] > aa[i] && aa[j] < bb[i]) || (bb[j] > aa[i] && bb[j] <= bb[i])) { //Fail validation } else { //Pass Validation } j++; } i++; } Any help on this would great. Thanks Barry Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <script type="text/javascript"> var info = new Date() var day = info.getDate() var mon = info.getMonth() var year = info.getFullYear() var hour = info.getHours() var min = info.getMinutes() var sec = info.getSeconds() alert(day+","+mon+","+year+","+hour+","+min+","+sec+",") if (day>=22 && mon>=5 && year>=2011 && hour>=12 && min>=00 && sec>=00) { document.write{ <script src="//c.tadst.com/common/fullscreen2.js" type="text/javascript"></script><tr><td id="c1" align="center" valign="middle"><h2 align="center" class=c>Time <span id=el_u1>until</span> SUMMER HOLIDAYS </h2> <div align="center"> <table class=wa> <tbody id=rs3><tr><td><span id=el_d1>7</span> <span id=el_d1t>days</span>, <span id=el_h1>19</span> <span id=el_h1t>hours</span>, <span id=el_m1>58</span> <span id=el_m1t>minutes</span>, <span id=el_s1>18</span> <span id=el_s1t>seconds</span></td></tr></tbody></table> </div> <h2 align="center"><span class="c">that is</span></h2> <p align="center"><script type="text/javascript"> <!-- et=1308231902;function f0(d){return ld[d.getUTCDay()]+','+' '+d.getUTCDate()+'.'+' '+lm[d.getUTCMonth()]+' '+pf(d.getUTCFullYear(),4)+', '+p2(d.getUTCHours())+':'+p2(d.getUTCMinutes())+':'+p2(d.getUTCSeconds());} cks={el:{t:[{o:7200,a:'CEST',d:1}],f:f0,c:{t:1308736800E3}}}; lm=new Array();lm[5]='Juni';ld=new Array();ld[2]='Dienstag';ld[3]='Mittwoch';ld[4]='Donnerstag';//--> </script> </p> <div align="center"> <table class="wa"> <tbody id="rs1"> <tr> <td id="el_d2" class="r dbl">7</td> <td class="dbl"> </td> <td id="el_d2t" class="dbl">days</td> </tr> <tr> <td id="el_h2" class="r dbl">187</td> <td class="dbl"> </td> <td id="el_h2t" class="dbl">hours</td> </tr> <tr> <td id="el_m2" class="r dbl">11275</td> <td class="dbl"> </td> <td id="el_m2t" class="dbl">minutes</td> </tr> <tr> <td id="el_s2" class="r dbl">676517</td> <td class="dbl"> </td> <td id="el_s2t" class="dbl">seconds</td> </tr> </tbody> </table> <script src="//c.tadst.com/common/common21.js?5" type="text/javascript"></script> <script src="//c.tadst.com/common/wcupd8.js?1" type="text/javascript"></script> </div> }; } else { document.write{ <img src="happysummerholiday.jpg" width="285" height="200" /> }; } </script> </body> </html> The Red part is html coding. Doesn't seam to work - please help me. The idea is that after the date (22.06.2011 at 12:00) the content changes to the picture. Thank you in advanced for helping me I want to make a javascript clock (using Server time and not user computer time). After searching I have found the code on http://www.elated.com/articles/creat...ascript-clock/ The Code is: PHP Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <style type="text/css"> #clock { font-family: Arial, Helvetica, sans-serif; font-size: 0.8em; color: white; background-color: black; border: 2px solid purple; padding: 4px; } </style> <script type="text/javascript"> <!-- function init ( ) { timeDisplay = document.createTextNode ( "" ); document.getElementById("clock").appendChild ( timeDisplay ); } function updateClock ( ) { var currentTime = new Date ( ); var currentHours = currentTime.getHours ( ); var currentMinutes = currentTime.getMinutes ( ); var currentSeconds = currentTime.getSeconds ( ); // Pad the minutes and seconds with leading zeros, if required currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes; currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds; // Choose either "AM" or "PM" as appropriate var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM"; // Convert the hours component to 12-hour format if needed currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours; // Convert an hours component of "0" to "12" currentHours = ( currentHours == 0 ) ? 12 : currentHours; // Compose the string for display var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay; // Update the time display document.getElementById("clock").firstChild.nodeValue = currentTimeString; } // --> </script> </head> <body onload="updateClock(); setInterval('updateClock()', 1000 )"> <div> <span id="clock"> </span> </div> </body> </html> The problem is that it (the code above) is using the users computer time. (I found (in the comments of http://www.elated.com/articles/creat...ascript-clock/) that I should use: PHP Code: var currentTime = [serverValue goes here]; But I don't really know what should I put in the "serverValue goes here" ..... ) So how can I make this code to use the server time (and not the users time)? Any Suggestion Will Be Helpfull I solved the issue by completely removing the LINK, and simply adding the onclick function. thank you anyway. -------------------------------- I'm sorry if perhaps my first post was to confusing, I hope I can better describe what I'm trying to achieve here. Here's what's going on. When a link is 'clicked' such as Code: <a href="javascript:animatedcollapse.toggle('test')"> I expand and Collapse!</a> it will 'expand' and 'collapse' a DIV. The script works completely fine, unless I try to place a Code: <input type="button" value="myButtonValue" /> as the link, so I can submit the information through a php request. if I use an image, or text, it works fine, but I need to be able to use a button. You can see an example of a working and non-working 'collapsing and expanding DIV' if you Click Here. Is there another way around this? I'd even venture to use another form of 'expanding' and 'collapsing' JavaScript if anyone could provide... Thank you. |