JavaScript - Live Person Talking Video? How To?
so im interested by those video of people walking out and talking on the screen like these links below:
http://www.premiumpostcard.com/ http://www.forcefactor.com/?&fb_lgid...4aaade4060d68b know my rational brain thinks well its just a video that is played with the background white or Green Screened to whatever. but the way i would do it in dreamweaver to insert a swf or video would provide a play button and stuff which these videos don't have. is there a code resource that i could apply to make this happen somewhere out there? Similar TutorialsHello, I am new here. I am having problems with a talking head video on my website www.getvms.com. A young woman pops up and speaks and then when you click on her a form to fill out is supposed to pop up. It works perfect in chrome and FF, but in IE the video just closes. Can someone tell me why that is? Or at least some type of direction? I found that when the script is in there twice it works, but of course that cause the video to echo. Here is the code for the page.... Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta name="verify-v1" content="+E5zkaC6JxDkzTZkPgdW9Gmj8aIXPzDPpIpeBsUDi0s=" > <title>VMS - Velocity Merchant Services - Downers Grove, IL</title><meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <meta name="description" content="Velocity Merchant Services of Downers Grove, IL offers credit card processing for Visa, MasterCard, American Express, and Discover allowing businesses to accept credit cards and debit cards."> <meta name="keywords" content="VMS, Velocity Merchant Services, Credit Card Terminals, Downers Grove Merchant Services, Oakbrook Merchant Services, Accept Credit Cards, Accept Debit Cards, Credit Card Processing, Merchant Service Provider, Merchant Card Services, Downers Grove Business Service, Oakbrook Business Service"> <meta http-equiv="content-language" content="en-us"> <meta name="robots" content="index,follow"> <meta name="googlebot" content="index, follow"> <meta name="revisit-after" content="10 days"> <meta name="author" content="Velocity Merchant Services - VMS"> <link href="style.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="menu/imenus0.css" type="text/css"> <link rel="stylesheet" href="cssverticalmenu.css" type="text/css"> <script src="swfobject.js" type="text/javascript"></script> <link rel="icon" href="/favicon.ico" type="image/x-icon"> </head> <body> <div id="container"> <div id="logo"><img src="images/logo.gif" alt="Logo"></div> <table width="781" border="0" align="center" cellpadding="0" cellspacing="0" style=" margin-top:10px; background:url(images/nav-bkgd.gif) no-repeat center top;"> <tr> <td><script language="JavaScript" src="menu/imenus0.js" type="text/javascript"></script></td> </tr> </table> <table width="781" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="781" colspan="3"> <div id="flasher"><img src="images/photo-home.jpg" alt="Velocity Merchant Services" width="781" height="164"></div> <script type="text/javascript"> var so = new SWFObject("flash_final.swf", "flash_content", "781", "222", "8"); so.addParam("wmode","transparent"); so.write("flasher"); </script></td> </tr> </table> <table width="781" border="0" align="center" cellpadding="5" cellspacing="0"> <tr> <td width="381" valign="top"><a href="about.html" onMouseOver="Tip('<b>Phone:</b> <br> (888) 902.6227 <br> <br> <b>Address:</b> <br> Velocity Merchant Services <br> 3051 Oak Grove Dr. (Second Floor) <br> Downers Grove, IL 60515')"> <h3> Welcome To Velocity Merchant Services </h3> Velocity Merchant Services </a> is a direct processor for Visa, MasterCard, American Express and Discover. Offering multiple payment options for your customers is the first step to increasing your company's cash flow.</p> <p>At VMS we will not only approve you to accept credit cards and debit cards from your customer; but we will help implement proven marketing strategies to help your business grow!<span class="style1"><br> </span></p> </td><td width="380" valign="top"><h3> Are You PCI Compliant?</h3> <P>Make sure your business is compliant with the latest PCI (Payment Card Industry) Data Security Standards to ensure your customers' confidential information is trasmitted in the most secure environment possible. <a href="/pci">Take our quick survey</a> and avoid non-compliance penalties.</P> <P><a href="/pci"><u>Take The PCI Compliance Survey</u></a>!</P> </td> </tr> <tr> <td colspan="2" valign="top"> </td> </tr> </table> <table width="781" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="196" align="center" valign="top"><table width="191" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" class="mainmenu" style="background-image:url(images/box-top.gif); background-position:top"><h2><a href="agent-services.html">Agent Services</a></h2></td> </tr> <tr> <td valign="top" style="background-image:url(images/box-bkgd.gif); background-position:top center; background-repeat:no-repeat;"> <div class="List"> <ul> <li><a href="become-a-partner.html">Become a Partner</a></li> <li><a href="value-added-services.html">Programs & Services</a></li> <li><a href="login.html">ISO Sales Agent Sign Up</a></li> <li><a href="news.html">News</a></li> <li><a href="resource-center.html">Resource Center</a></li> <li><a href="careers.html">Careers</a></li> </ul> </div> </td> </tr> </table> </td> <td width="195" align="center" valign="top"><table width="191" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" class="mainmenu" style="background-image:url(images/box-top.gif); background-position:top"><h2><a href="existing-merchants.html">Existing Merchants</a></h2></td> </tr> <tr> <td align="center" valign="top" style="background-image:url(images/box-bkgd.gif); background-position:top center; background-repeat:no-repeat;"> <div class="List"> <ul> <li><a href="service-upgrade.html">Service Upgrades / Additions</a></li> <li class="list-spacing"><a href="customer-service.html">Tech Support / Customer Service</a></li> <li><a href="order-free-supplies.html">Order Free Supplies</a></li> <li><a href="american-express-card.html">American Express Card</a></li> <li><a href="referralprogram.html">Referrals</a></li> <li><a href="faq.html">FAQ's</a></li> </ul> </div></td> </tr> </table></td> <td width="195" align="center" valign="top"><table width="191" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" class="mainmenu" style="background-image:url(images/box-top.gif); background-position:top"><h2><a href="value-added-services.html">Value Added Services</a></h2></td> </tr> <tr> <td align="center" valign="top" style="background-image:url(images/box-bkgd.gif); background-position:top center; background-repeat:no-repeat;"> <div class="List"> <ul> <li><a href="vms-fast-cash.html">Cash Advances</a></li> <li><a href="gift-cards.html">Gift Cards</a></li> <li><a href="web-development.html">Web Development</a></li> <li><a href="check-services.html">Guarantee Check Service</a></li> <li><a href="eletronic-benefits-transfer.html">Electronic Benefit Transfer</a></li> <li><a href="business-cards.html">Business Cards</a></li> <li><a href="http://www.getvms.com/icharge/">iCharge</a></li> </ul> </div></td> </tr> </table></td> <td width="195" align="center" valign="top"><table width="191" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" class="mainmenu" style="background-image:url(images/box-top.gif); background-position:top"><h2><a href="merchant-services.html">Merchant Services</a> </h2></td> </tr> <tr> <td align="center" valign="top" style="background-image:url(images/box-bkgd.gif); background-position:top center; background-repeat:no-repeat;"> <div class="List"> <ul> <li><a href="retail.html">Retail</a></li> <li><a href="restaurant.html">Restaurant</a></li> <li><a href="health-pharmaceuticals.html">Health/Pharmaceuticals</a></li> <li><a href="service.html">Service</a></li> <li><a href="mail-order.html">Mail Order / Telephone Order</a></li> <li><a href="ecommerce.html">eCommerce</a></li> </ul> </div></td> </tr> </table></td> </tr> </table> <br> <table width="781" border="0" align="center" cellpadding="20" cellspacing="0" style="background-image:url(images/footer-bkgd.gif); background-repeat:no-repeat" id="footer"> <tr> <td width="541" align="center" valign="middle"><p><a href="index.html">Home</a> :: <a href="about.html">About VMS</a> :: <a href="merchant-services.html">Merchant Services</a> :: <a href="web-development.html">Web Development</a> :: <a href="vms-fast-cash.html">Cash Advances</a><br> <a href="credit-card-terminals.html">Credit Card Terminals</a> :: <a href="request-information.php">Request Info</a> ::<a href="contact.html"> Contact</a> :: <a href="privacy-policy.html">Privacy Policy</a></p> <p>© 2010 Velocity Merchant Services. VMS is a registered ISO and MSP of HSBC Bank, USA<br> National Association, Buffalo, NY</p></td> <td width="160" align="center" valign="middle"><p>Velocity Merchant Services<br> 3051 Oak Grove Road<br> Downers Grove, IL 60515<br> Phone: (888) 902.6227<br> Fax: (888) 902.6229</p></td> </tr> </table> <br> <table align="center" width="781" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left"><table border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="middle"><a href="application.php"><img src="images/creditcards.jpg" alt="Apply Now!" border="0"></a></td> </tr> </table> <p> </p></td> <td align="right"><table border="0" cellspacing="0" cellpadding="0"> <tr> <td><a rel="nofollow" target="_blank" href="http://www.bbbonline.org/cks.asp?id=1061023114246"><img src="images/bbb.gif" alt="Click to verify BBB accreditation and to see a BBB report." width="40" height="64" border="0" title="Click to verify BBB accreditation and to see a BBB report."></a></td> <td style="padding: 0 15px"><a href="http://www.uschamber.com/sb" rel="nofollow" target="_blank"><img src="http://www.uschamber.com/sb/websticker/image.asp?i=a2&m=999999" alt="U.S. Chamber of Commerce Member 2008" hspace="10" title="U.S. Chamber of Commerce Member 2008"></a></td> <td><script type="text/javascript" src="http://sealserver.trustkeeper.net/compliance/seal_js.php?code=w6otlmrNfNOhkhjNVXmBsFWOX2IVM8&style=normal&size=105x54&language=en"></script> <noscript> <a href="https://sealserver.trustkeeper.net/compliance/cert.php?code=w6otlmrNfNOhkhjNVXmBsFWOX2IVM8&style=normal&size=105x54&language=en" rel="nofollow" target="hATW"><img src="http://sealserver.trustkeeper.net/compliance/seal.php?code=w6otlmrNfNOhkhjNVXmBsFWOX2IVM8&style=normal&size=105x54&language=en" alt="Trusted Commerce" border="0"></a> </noscript></td> <td width="179"> <a href="docs/ViewComplianceCertificate.action.pdf" rel="nofollow" target="_blank"><img src="images/compliance%20icon.jpg" width="175" height="74" border="0" align="right" alt="Compliance"></a></td> </tr> </table> <table align="right"><tr><td><p> <!-- <a href="http://jigsaw.w3.org/css-validator/check/referer"> <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> </a>--> </p></td><td> <p> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88" border="0"></a>--> </p></td></tr></table> </td> </tr> </table> <script language="JavaScript" src="menu/ocscript.js" type="text/javascript"></script> <script language="JavaScript" src="wz_tooltip.js" type="text/javascript"></script> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-4568625-2"); pageTracker._initData(); pageTracker._trackPageview(); </script> <script language="javascript" type="text/javascript" src="wthvideo/wthvideo.js"></script> </div> </body> </html> for the javascript.... Code: // Copyright 2010 Website Talking Heads // JavaScript Document if (typeof wthvideo == 'undefined') { wthvideo = new Object(); } wthvideo.params = { width:272, height:384, position:"fixed", doctype:"strict", left:"auto", right:"0px", top:"auto", bottom:"0px", centeroffset:"auto", color:0x022918, volume:70, autostart:"yes", fadein:1, fadeout:2, delay:0, delayclose:5, buffertime:3, playbtn:"PlayVideo.png", playposition:"right", playtop:"bottom", exitoncomplete:"yes", oncepersession:"no", vidlink:"http://www.getvms.com/request-information.php", openin:"_blank", path:"wthvideo", actorpic:"rennygetvms3410.png", flv:"rennygetvms3410.flv" }; var topPx = parseFloat(wthvideo.params.top); var bottomPx = parseFloat(wthvideo.params.bottom); wthvideo.hideDiv = function(){ document.getElementById('wthvideo').style.visibility = 'hidden'; } function onlyOnce() { if (document.cookie.indexOf("hasSeen=true") == -1) { var later = new Date(); later.setFullYear(later.getFullYear()+10); document.cookie = 'hasSeen=true;path=/;'; wthvideo.drawVideo(); } } if (navigator.appName.indexOf("Microsoft") != -1) { var topWth = 577; } else { var topWth = 582; } wthvideo.drawVideo= function(){ var markUp = ''; markUp += '<style type="text/css">'; markUp += '#wthvideo {position:'+wthvideo.params.position+';width:'+wthvideo.params.width+'px;height:'+wthvideo.params.height+'px;margin-left:'+wthvideo.params.centeroffset+';left:'+wthvideo.params.left+';right:'+wthvideo.params.right+';top:'+wthvideo.params.top+';bottom:'+wthvideo.params.bottom+';z-index:99999999999;}'; markUp += '</style>'; markUp += '<div id="wthvideo">'; markUp += ' <object id="objvideo" style="outline:none;" type="application/x-shockwave-flash" width="'+wthvideo.params.width+'" height="'+wthvideo.params.height+'" data="'+wthvideo.params.path+'/wthplayer.swf">'; markUp += ' <param name="movie" value="'+wthvideo.params.path+'/wthplayer.swf" />'; markUp += ' <param name="quality" value="high" />'; markUp += ' <param name="flashvars" value="vurl='+wthvideo.params.flv+'&vwidth='+wthvideo.params.width+'&vheight='+wthvideo.params.height+'&actorpic='+wthvideo.params.path+'/'+wthvideo.params.actorpic+'&autostart='+wthvideo.params.autostart+'&exitoncomplete='+wthvideo.params.exitoncomplete+'&vbuff='+wthvideo.params.buffertime+'&vdelay='+wthvideo.params.delay+'&vcolor='+wthvideo.params.color+'&vlink='+wthvideo.params.vidlink+'&openin='+wthvideo.params.openin+'&delayclose='+wthvideo.params.delayclose+'&fadein='+wthvideo.params.fadein+'&fadeout='+wthvideo.params.fadeout+'&vvol='+wthvideo.params.volume+'&playbtn='+wthvideo.params.path+'/'+wthvideo.params.playbtn+'&playpos='+wthvideo.params.playposition+'&playtop='+wthvideo.params.playtop+'" />'; markUp += ' <param name="wmode" value="transparent" />'; markUp += ' <param name="allowscriptaccess" value="always" />'; markUp += ' <param name="swfversion" value="9.0.45.0" />'; markUp += ' </object>'; markUp += '</div>'; markUp += '<div id="highlightWth" style="position:absolute; width:150px; height:30px; left:50%; top:'+topWth+'px; visibility:hidden">'; markUp += '<img src="wthvideo/orangecircledrawn.png">'; markUp += '</div>'; if (wthvideo.params.position == "fixed") { if (wthvideo.params.doctype == "quirks") { if (wthvideo.params.top == "auto") { markUp += '<!--[if IE]>'; markUp += '<style type="text/css">'; markUp += '#wthvideo {position:absolute; top: expression(offsetParent.scrollTop - 1 + (offsetParent.clientHeight-this.clientHeight) + '+bottomPx+' + "px")}'; markUp += '</style>'; markUp += '<![endif]-->';} else { markUp += '<!--[if IE]>'; markUp += '<style type="text/css">'; markUp += '#wthvideo {position: absolute !important;top: expression(((document.documentElement.scrollTop || document.body.scrollTop) + (!this.offsetHeight && 0)) + '+topPx+' + "px")'; markUp += '</style>'; markUp += '<![endif]-->';} } else { markUp += '<!--[if lte IE 6]>'; markUp += '<style type="text/css">'; markUp += 'html, body{height: 100%;overflow: auto;}#wthvideo {position: absolute;}'; markUp += '</style>'; markUp += '<![endif]-->'; } } document.write(markUp); } function hideDiv() { wthvideo.hideDiv(); } if (wthvideo.params.oncepersession == "yes") { onlyOnce();} else { wthvideo.drawVideo(); } function thisMovie(movieName) { if (navigator.appName.indexOf("Microsoft") != -1) { return window[movieName]; } else { return document[movieName]; } } function cue0Bright() { document.getElementById('highlightWth').style.visibility = 'visible'; } function cue0Normal() { document.getElementById('highlightWth').style.visibility = 'hidden'; } function cue0() { cue0Bright(); setTimeout("cue0Normal();", 3000); } function cue1Bright() { document.getElementById('highlightWth').style.visibility = 'visible'; document.getElementById('highlightWth').style.top = topWth+38+'px'; } function cue1Normal() { document.getElementById('highlightWth').style.visibility = 'hidden'; } function cue1() { cue1Bright(); setTimeout("cue1Normal();", 1500); } function cue2Bright() { document.getElementById('highlightWth').style.visibility = 'visible'; document.getElementById('highlightWth').style.top = topWth+19+'px'; } function cue2Normal() { document.getElementById('highlightWth').style.visibility = 'hidden'; } function cue2() { cue2Bright(); setTimeout("cue2Normal();", 4000); } I need to get this figured out fairly quickly. As I said the pop-ups work in FF and Chrome, but in IE the program just closes. I'm working on a upload script that uses javascript, and a hidden iframe to upload the files. It all works up until the iframe finishes and needs to send the javascript function call back to the parent page, nothing happens, when it should hide the upload progress bar. I've searched and searched for the awnser, along with trying different alternative to window.top.window, such as window.top, parent, and parent.document and so far nothing has worked, I've even tried the onLoad on the iframe with no success. Parent Page function: Code: function stopUpload(success, ups, file) { var result = ''; var uploaded = '0'; if (success == 1) { result = '<span class="msg">The file was uploaded successfully!<\/span><br>'; uploaded = uploaded ++; if (uploaded == document.getElementById('numflowers').value) { document.getElementById(finish).style.display = 'block'; } } else if (success == 2) { result = '<span class="msg">There was an error during file upload! The file has a size of 0<\/span><br> File: <input name="ufile[]" id="ufile[]" type="file" size="30"> <input type="submit" name="submitBtn" value="Upload">'; } else if (success == 3) { result = '<span class="msg"> We only allow .png, .jpg, .gif, .zip, .rar, and .7z files to be uploaded. If you think we should allow other please make a suggestion on the forums.<\/span><br> File: <input name="ufile[]" id="ufile[]" type="file" size="30"> <input type="submit" name="submitBtn" value="Upload">'; } var uploadp = "upload_process" + ups; var uploadf = "upload_form" + ups; document.getElementById('uploadp').style.display = 'none'; document.getElementById('uploadf').innerHTML = 'result'; document.getElementById('uploadf').style.display = 'block'; } Function call inside iframe (example) Code: window.top.window.stopUpload(3, 1, test.txt) Thanks for the help. Hi, I am trying to write a script that will take a date of birth and another date and, if the person was over 75 years old on the createdDate, return "true" (otherwise return "false"). Unfortunately my code doesn't seem to return either 'true' or 'false'! Any help would be grately appreciated. The code is: Code: var dateofBirth="30/10/1982"; var createdDate="01/12/2010"; var sd = dateofBirth.split('/'); var dob = new Date(sd[2],sd[1],sd[0]); sd = createdDate.split('/'); var submit = new Date(sd[2],sd[1],sd[0]); var age=submit-dob; var ageYears=Math.floor((((age/3600000)/24)+1)/365.25); if(ageYears>75) document.write("true") else document.write("false") ; would anyone here know of a good tutorial I could look up and/or code I could study? thank you D Hi, I currently created a video uploader, but when the video is too big in size, the page seems to be not doing any until the video is completely uploaded. I want to put somewhat like "loading.. please wait" script until the video is not completely uploaded. Thanks. //Ana Can some one help me step me through this last part of my script i have made. I have completed my entire chat program but currently i use: <meta http-equiv="refresh" content="5; URL=shout.php"> This is what keeps my chat room up to date, but this is pretty ugly due to the fact the browser makes a refresh. So i was hopeing some one could step my through to add ajax that makes a live affect with it appear to refresh. The script that has this chat is in the structure of: Code: <meta http-equiv="refresh" content="5; URL=shout.php"> <?php function get_chats(){ //query //while loop the logs out } getlogs(); ?> And thats it. I took a look on W3 about ajax and most of it was involve an event occuring such as submit/on key press which isn't what i want as some times a user may not do anything but i still want the chat to keep "up to date". I found one tutorial but it was over complicated to just take snippets out to put on my chat without knowing what it did or what to change for my chat to make it to work. Hope you can help - im a quick learner when i see the right example of what i need. Hi guys im trying use a live search on my website, and iv found a code on the following link: http://www.w3schools.com/php/php_ajax_rss_reader.asp i understand it all but need to tweak it to suit my needs. What i need for it to do is search multiple drop down requests, for example: 1. first name 2. last name I want it to search by what has been selected (it is not necesary that all fields need to be selected, default will be any), however in the html it states: xmlhttp.open("GET","getrss.php?q="+str,true); and it only shows 1 option, i would like it to show multiple records. and once the records are shown, I would like the option of amending the search result any time in the search. please help Hey I've created a new homepage for my cubecart shop, but when I upload it it doesn't display, I've check all resources and they are all being loaded Here is the site: http://www.genyx.co.uk/ Here is what it is supposed to look like: http://www.genyx.co.uk/Genyx%20Theme/html/index.htm Can anyone help? I want to run a piece of javascript on a live page that I don't have backend control of. I know it's possible. I've never done it before though. I'm in google chrome. This is what I see. I have no idea what I'm doing Do you log JavaScript errors on your live website? The actual errors that users experience? If you do, what tool do you use? And how is it woring out? If you don''t why not? Hi, I'm working on a project that will display a form that takes in the amount of Money I earn in a given month. This value is inserted into the code, and once submitted, a Live Updating value will display how much $ I would have earned so far this month. This counter will work and display much like Gas Pumps increment. So in example: I type in that I make $1,000 per month. Once submitted, the count begins. The code will figure out how much money I will be making every second of the day, and update it live. This value updates live displaying something like $0.0012. If I earn $1 Million per month, then the values would increment much faster. Could anyone give me some input? Thanks So, I am working out a current issue I'm having with a sortable table script. Code: var sortableTable = new Class({:thumbsup: getOptions: function(){ return { overCls: false, onClick: true, sortOn: 0, sortBy: 'ASC', filterHide: true, filterHideCls: 'hide', filterSelectedCls: 'selected' }; }, initialize: function(table, options){ this.setOptions(this.getOptions(), options); this.table = $(table); this.tHead = this.table.getElement('thead'); this.tBody = this.table.getElement('tbody'); this.tFoot = this.table.getElement('tfoot'); this.elements = this.tBody.getElements('tr'); this.filtered = false; /*for(i=0;i<10;i++){ this.elements.clone().injectInside(this.tBody); } this.elements = this.tBody.getElements('tr');*/ //THIS IS FOR ANIMATION AND POINTER EFFECT ON HOVER this.elements.each(function(el,i){ if(this.options.overCls){ el.addEvent('mouseover', function(){ el.addClass(options.overCls); }, this); el.addEvent('mouseout', function(){ el.removeClass(options.overCls); }); } if(this.options.onClick){ el.addEvent('click', options.onClick); } }, this); //setup header this.tHead.getElements('th').each(function(el,i){ if(el.axis){ el.addEvent('click', this.sort.bind(this,i)); el.addEvent('mouseover', function(){ el.addClass('tableHeaderOver'); }); el.addEvent('mouseout', function(){ el.removeClass('tableHeaderOver'); }); el.getdate = function(str){ // inner util function to convert 2-digit years to 4 function fixYear(yr) { yr = +yr; if (yr<50) { yr += 2000; } else if (yr<100) { yr += 1900; } return yr; }; var ret; // if (str.length>12){ strtime = str.substring(str.lastIndexOf(' ')+1); strtime = strtime.substring(0,2)+strtime.substr(-2) }else{ strtime = '0000'; } // // YYYY-MM-DD if (ret=str.match(/(\d{2,4})-(\d{1,2})-(\d{1,2})/)) { return (fixYear(ret[1])*10000) + (ret[2]*100) + (+ret[3]) + strtime; } // DD/MM/YY[YY] or DD-MM-YY[YY] if (ret=str.match(/(\d{1,2})[\/-](\d{1,2})[\/-](\d{2,4})/)) { return (fixYear(ret[3])*10000) + (ret[2]*100) + (+ret[1]) + strtime; } return 999999990000; // So non-parsed dates will be last, not first }; // el.findData = function(elem){ var child = elem.getFirst(); if(child){ return el.findData(child); }else{ return elem.innerHTML.trim(); } }; // el.compare = function(a,b){ var1 = el.findData(a.getChildren()[i]); var2 = el.findData(b.getChildren()[i]); //var1 = a.getChildren()[i].firstChild.data; //var2 = b.getChildren()[i].firstChild.data; if(el.axis == 'number'){ var1 = parseFloat(var1); var2 = parseFloat(var2); if(el.sortBy == 'ASC'){ return var1-var2; }else{ return var2-var1; } }else if(el.axis == 'string'){ var1 = var1.toUpperCase(); var2 = var2.toUpperCase(); if(var1==var2){return 0}; if(el.sortBy == 'ASC'){ if(var1<var2){return -1}; }else{ if(var1>var2){return -1}; } return 1; }else if(el.axis == 'date'){ var1 = parseFloat(el.getdate(var1)); var2 = parseFloat(el.getdate(var2)); if(el.sortBy == 'ASC'){ return var1-var2; }else{ return var2-var1; } }else if(el.axis == 'currency'){ var1 = parseFloat(var1.substr(1).replace(',','')); var2 = parseFloat(var2.substr(1).replace(',','')); if(el.sortBy == 'ASC'){ return var1-var2; }else{ return var2-var1; } } } if(i == this.options.sortOn){ el.fireEvent('click'); } } }, this); }, sort: function(index){ if(this.options.onStart){ this.fireEvent('onStart'); } // this.options.sortOn = index; var header = this.tHead.getElements('th'); var el = header[index]; header.each(function(e,i){ if(i != index){ e.removeClass('sortedASC'); e.removeClass('sortedDESC'); } }); if(el.hasClass('sortedASC')){ el.removeClass('sortedASC'); el.addClass('sortedDESC'); el.sortBy = 'DESC'; }else if(el.hasClass('sortedDESC')){ el.removeClass('sortedDESC'); el.addClass('sortedASC'); el.sortBy = 'ASC'; }else{ if(this.options.sortBy == 'ASC'){ el.addClass('sortedASC'); el.sortBy = 'ASC'; }else if(this.options.sortBy == 'DESC'){ el.addClass('sortedDESC'); el.sortBy = 'DESC'; } } // this.elements.sort(el.compare); this.elements.injectInside(this.tBody); // if(this.filtered){ this.filteredAltRow(); }else{ this.altRow(); } // if(this.options.onComplete){ this.fireEvent('onComplete'); } }, altRow: function(){ this.elements.each(function(el,i){ if(i % 2){ el.removeClass('altRow'); }else{ el.addClass('altRow'); } }); }, filteredAltRow: function(){ this.table.getElements('.'+this.options.filterSelectedCls).each(function(el,i){ if(i % 2){ el.removeClass('altRow'); }else{ el.addClass('altRow'); } }); }, filter: function(form){ var form = $(form); var col = 0; var key = ''; form.getChildren().each(function(el,i){ if(el.id == 'column'){ col = Number(el.value); } if(el.id == 'keyword'){ key = el.value.toLowerCase(); } if(el.type == 'reset'){ el.addEvent('click',this.clearFilter.bind(this)); } }, this); if(key){ this.elements.each(function(el,i){ if(this.options.filterHide){ el.removeClass('altRow'); } if(el.getChildren()[col].firstChild.data.toLowerCase().indexOf(key) > -1){ el.addClass(this.options.filterSelectedCls); if(this.options.filterHide){ el.removeClass(this.options.filterHideCls); } }else{ el.removeClass(this.options.filterSelectedCls); if(this.options.filterHide){ el.addClass(this.options.filterHideCls); } } }, this); if(this.options.filterHide){ this.filteredAltRow(); this.filtered = true; } } }, clearFilter: function(){ this.elements.each(function(el,i){ el.removeClass(this.options.filterSelectedCls); if(this.options.filterHide){ el.removeClass(this.options.filterHideCls); } }, this); if(this.options.filterHide){ this.altRow(); this.filtered = false; } } }); sortableTable.implement(new Events); sortableTable.implement(new Options); It works flawlessly on my dev page: http://www.align.com/Dev/Resources/ But I am having issues with is on my live page: http://www.align.com/Resources/ My first thought is that it could be a labeling issue (ie: I forgot to remove "/dev" when moving the HTML over to live) but after reviewing for an hour, I don't believe this is the issue. Could it be an ASP issue? thx in advance.... -Mike Fortuna http://turtle-tv.com I already have the server time (top left) in a live format but this other bit is a bit much for me as I know little to nothing about JS and the code in question isnt mine. Anyway, the bit in the parenthesis which depending on the current server time will read Lights on in ??? or Lights off in ??? I would like to have turned in to a liver ticker while keeping all of it's current functionality. Like lets say it was 7:59:59pm EST time the message in the parenthesis would read (Lights off in 1 sec) then come 8:00:00pm the message would do a live rollover to read (Lights on in 11 Hrs, 30 Mins & 0 Secs) then count down from there and then come lets say 7:39:59am EST the message would read (Lights on in 1 Sec) and come 7:30:00am EST the message would roll over to the lights off message. If this is something you can do then great but if not then thankyou for at least reading my post. If you are able to do this and can improve on existing code for the liver server clock then please do that as well as there's some redundant code I don't even need for stuff liek the day etc since I'm just displaying as hh:mm am/pm clock in a 12hr format. Code: <head> <title>Niko's Live 24/7 Video Broadcast</title> <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-php")? '<!--#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+")" this.container.innerHTML=formatField(hour, 1)+":"+formatField(minutes)+""+ampm+"" // --> } 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> </head> <body background="./smalls_file_mainBg_1919366_7636654_l.jpg"> <font size="2" color="FFFF00" style="background: #181818;">Time Now: <span id="timecontainer">Loading...</span></font> <script type="text/javascript"> new showLocalTime("timecontainer", "server-php", 0, "short") </script> <?php $lights_on = '7:30am'; $lights_off = '8pm'; $time = lights_on_off(time(), $lights_on, $lights_off); ?> <center> <font size="5" color="FFFF00" style="background: #181818;"> Lights out from <?php echo $lights_off; ?> to <?php echo $lights_on; ?> <?php echo date('T'); ?> (Lights <?php echo $time['n_state']; ?> in <?php $h = ($time['remaining']['m'] + 1 ==60) ? $time['remaining']['h'] + 1 : $time['remaining']['h']; $m = ($time['remaining']['m'] + 1 ==60) ? 0 : $time['remaining']['m']; $s = ($time['remaining']['m'] + 1 ==60) ? 0 : $time['remaining']['s']; echo ($h>1) ? $h . ' Hrs, ' : (($h==1) ? $h . ' Hr, ' : ' '); echo ($m>1) ? $m . ' Mins & ' : (($m==1) ? $m . ' Min & ' : ' '); echo ($s>1) ? $s . ' Secs' : (($s==1) ? $s . ' Sec' : '0 Secs'); ?> ) !</font></center> <?php function lights_on_off($time, $lights_on, $lights_off){ $time = (isset($time)) ? $time : time(); $d_lights_on = strtotime($lights_on); $d_lights_off = strtotime($lights_off); $secs_lights_on = (date("G",$d_lights_on)*60 + date("i",$d_lights_on))*60 + date("s",$d_lights_on); $secs_lights_off = (date("G",$d_lights_off)*60 + date("i",$d_lights_off))*60 + date("s",$d_lights_off); $secs = (date("G",$time)*60 + date("i",$time))*60 + date("s",$time); $c_state = ($secs_lights_on < $secs && $secs < $secs_lights_off) ? 'on' : 'off'; $n_state = ($secs_lights_on < $secs && $secs < $secs_lights_off) ? 'off' : 'on'; $next_switch = ($secs_lights_on < $secs && $secs_lights_off > $secs) ? $secs_lights_off : ($secs_lights_on + 60*60*24); $next_switch = ($next_switch > ($secs+60*60*24)) ? $next_switch - (60*60*24) : $next_switch; $time_rem = $next_switch - $secs; $h = floor($time_rem/(60*60)); $m = floor(($time_rem-($h*60*60))/60); $s = $time_rem-($h*60*60)-($m*60); return array('c_state' => $c_state,'n_state' => $n_state, 'remaining' => array('secs' => $next_switch, 'h' => $h, 'm' => $m, 's' => $s)); } ?> <center> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="600" height="523" id="utv451302"> <param name="flashvars" value="autoplay=false&brand=embed&cid=1919366"/><param name="allowfullscreen" value="true"/> <param name="allowscriptaccess" value="always"/><param name="movie" value="http://www.ustream.tv/flash/live/1/1919366"/> <embed flashvars="autoplay=false&brand=embed&cid=1919366" width="625" height="545" allowfullscreen="true" allowscriptaccess="always" id="utv451302" name="utv_n_740840" src="http://www.ustream.tv/flash/live/1/1919366" type="application/x-shockwave-flash" /></object> <iframe scrolling="no" height="523" frameborder="0" width="576" src="./prochatrooms/index.php"></iframe> </center> </body> I have an external .js file that ends its process with a document.write() command. This needs to be called near the end of the HTML page, right before </body>. Am I better off calling the external .js at the desired location in the footer? Or making the .js into a defined function, loading the .js in the <head> portion and then executing the function in the footer? - M. I'm trying to figure out how to display the live price of gold on a site. I've been googling for 2 hours and have gotten nowhere, most results are people trying to sell you something. I just want a simple display of the price of gold on a site, and don't know where to start. If anyone has any idea, or has done something similar to this, let me know. I appreciate it I have used an excellent template which uses JS to display background images. However while this works locally it doesn't when published. The site structure is sound and I notice this happens with the source files I downloaded also so it's nothing I have done in my build which could have caused this. This is the link to my site, everything is fine except the background image not showing. http://www.khawkinsdesign.com Any ideas, as I say fine locally, not fine when published? Hi all, First... this isn't homework... Now, I'm trying to make a live Regular Expression evaluator and I thought it would be really simple, but it's not working. Here's the JS I wrote..... Code: <html> <head> <style type="text/css"> body { background-color:#ddeeff; } textarea#inp1, textarea#inp2, textarea#out1 { margin:0 25%; margin-bottom:1%; border:0; padding:0; width:50%; height:100px; border: 1px solid #000000; } p { margin:0 25%; } </style> <script type="text/javascript"> function test() { var inp1 = document.getElementById('inp1'); /* regex in here */ var inp2 = document.getElementById('inp2'); /* test string here */ var out1 = document.getElementById('out1'); /* results here */ r = inp1.value.split(','); /* get find , replace */ var str = inp2.value; var find = r[0] || ''; var repl = r[1] || ''; var result = str.replace(find, repl); out1.value = result; } </script> </head> <body> <p>regex</p> <textarea id="inp1"></textarea> <p>test string</p> <textarea id="inp2"></textarea> <p>result</p> <textarea id="out1"></textarea> <script type="text/javascript"> setInterval('test()', 100); </script> </body> </html> Now, it DOES work if I do something simple like enter the word "Test" for the test string and T,X for the "regex" (the result transforms into "Xest" as it should). But if I put in something like this: /<p(.*?)>(.*?)<\/p>/gi,'$2' for the regex and <p class="test">Hello</p> for the test string The result is <p class="test">Hello</p> when it should be just Hello I can put regex strings into an array and of course it works (for example): Code: var find = [/<p>/g,/<\/p>/g]; var repl = ['P open', 'P close']; var n = find.length; while (n--) str = str.replace(find[n], repl[n]); ...blah...blah... So why doesn't my code work when I'm using variables that contain find and replace strings??? Am I missing something, or can it not be done this way? -- Roger (edit to add): The above code is online HERE Hello, I'm a novice with java script and I can't figure out why my script will work locally, but not live. Here is the link. http://www4.uwm.edu/recsports/ There is supposed to be a rotating slideshow in the header, but it's just a black box. Thanks! Hi I hope someone can help me or direct me to the right place.... Here is the situation. I am a graphic guy and do some web design but am not really good with javascript. I am using the enlargeit.js program for the photo viewer on www.blackwoodsconcrete.com in the galleries. It has worked wonderfully up till now. I recieved new pictures from the owner to post on his page and they will not open when i view them live. I use dreamweaver cs5 and when i look in preview mode, they work great. They are standard jpg images. see http://www.blackwoodsconcrete.com/example_error.html for an example. The top pic does not work and the rest do... I have resized them, changed file formats, opened them in photoshop and edited them, and basically anything else you could think of, i tried. Even if i open one of the working photos in photoshop and place the new one over it and save it as something completely different it still does not work! everything else does. Does anyone have any clue what to do? Thanks in advance! TK |