JavaScript - Is It Possible To Display The Duration A Webpage Is Accessed Using Javascript
Hi. Can someone tell me if it is possible to display the duration a webpage is accesssed. For example, if its a form webpage, then the time to be displayed will be = time the webpage was left (press submit button etc. or the time the viewer left the page) - time the webpage was first accessed or loaded.
If it is possible with javascript, what are the methods, attributes etc that need to be used. Similar TutorialsI maintain a website for a small local restaurant. I do this with FrontPage so I know very little coding. I have an upload manager so the owner can remotely upload a txt or doc file of daily specials to a folder on the server. I would like to put a java script into one of the web pages that would open and display this file on page load. Is that possible and can someone help with the code, Thanks I have the ability to remotely upload a text file to a folder on my web server. Periodically during the day I update that file and re-upload it which overwrites the previous file. I am looking for a script to insert in a webpage that will "get" and display the current version of that file on page load. Thanks in advance. Hi! First post here! Would really appreciate some help on a javascript that would display the time elapsed since a particular visitor last visited my webpage, using cookies. So basically it should show something like: "You last visited my page 2 days & 12 mins ago!" I've a little background in java but none in javascript... Thanks so much! Bit of a noob when it comes to js. Hope someone can help me out. I am trying to place text output from a url on another webpage. The output is the status of an alarm system. The URL is: Code: https://www.eye-zon.com/EZMOBILE/index.php?mid=<hash>&action=ssi&did=<mac> hash and mac info remove for security reasons. The URL leads to a webpage that outputs: Code: <update>2011-08-18 21:21:10</update><status> Stay Armed </status><trouble>NO</trouble> I would like to place these three outputs on another page. Any ideas? Hi !......... I have just added a very fine Script (made by Tyler Clarke) to my website - only problem are that I need to add some duration to the slideshow !....... This is the actual Script: http://www.javascriptkit.com/script/...domslide.shtml It will be most appreciated if someonen could help me adding the duration !.... ' Thank you !...... Hi Guys I have created a flight/hotel itinerary and I need to work out the duration of the customers' holiday in order to work out how much it will cost to charge that person per night at their selected hotel. The problem I have is that the dates are going to vary due to user inputs in which I have used jquery 's " datepicker " Cheers George Hi all, I'm trying to find what I'm sure is a simple bit of js which I can use that will close a div for the duration of a users visit as it would hide a notice I'd only want to display once on a site. Essentially all I'd want to do is have a simple div with a paragraph and a link to close the div but to have it remember across pages that the user has dismissed the notice. I noticesearched around and found a similar request here but I don't know js enough to replace the inputs in the example to a simple link and to remove the show div functionality. Anyone able to provide me with any pointers on how I'd be able to achieve this? Many thanks, J. I'm trying getting one of my webpage XHTML 1.0 Strict. There is only one error left, namely: document type does not allow element "br" here at this line: Code: container.innerHTML = result.translation.replace(/mdw/g, '<br />'); Obviously this is part of my javascript coding, but it's where the validation goes wrong. I can't put the javascript in an external file since several javascript variables are getting filled by php. I've tried several options, but I ain't a javascript expert.. so perhaps someone can help me out. Complete and utter newb here, so I apologize in advance. I'm trying to create a widget for a website that will show the Recent Comments, but will limit what is shown to 1 comment per unique thread. The idea being that the popular threads don't drown out the unpopular threads in the widget. Alas, I do not know Javascript. I am, however, proficient in XSLT. So I mapped out a little transform to get (essentially) what I want, thus: Input: http://anamardoll.disqus.com/latest.rss XSLT: Code: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template name="RSS_Feed" match="rss"> <xsl:value-of select="'
'"/> <!-- ITERATE THROUGH ALL POST NODES --> <xsl:for-each select="//item"> <!-- IF NOT PREVIOUSLY USED --> <xsl:if test="not(preceding-sibling::item/child::title/node() = current()/child::title/node())"> <xsl:value-of xmlns:dc="http://purl.org/dc/elements/1.1/" select="child::dc:creator/node()"/> <xsl:value-of select="(' posted on 
')"/> <xsl:value-of select="substring-after(child::title/node(), 'Ramblings: ')"/> <xsl:value-of select="('
')"/> <xsl:value-of select="child::link/node()"/> <xsl:value-of select="('

')"/> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet> Output: Code: Ana Mardoll posted on Twilight: It's All About The Protagonist, Baby http://www.anamardoll.com/2011/09/twilight-its-all-about-protagonist-baby.html#comment-320798527 Thepepboy posted on eReader: Running CM7 on a Nook Color from SD Card (REPOST) http://www.anamardoll.com/2011/07/ereader-running-cm7-on-nook-color-from.html#comment-320690496 Jckeeml posted on Narnia: The Clean and Tidy Poor http://www.anamardoll.com/2011/09/narnia-clean-and-tidy-poor.html#comment-320649311 chris the cynic posted on Metapost: Newsletter Subscriptions http://www.anamardoll.com/2011/09/metapost-newsletter-subscriptions.html#comment-320586205 (And here is why I say the output is "essentially" what I want -- I'd PREFER the links to be linked around the preceding texts, but that's an advanced step at this point in the game.) Is there an easy way in Javascript to just invoke an XSLT on a webpage and display the results? I've read online that there is, but can find no examples that work for me. I do appreciate any help provided and thank you in advance! (Also, for background: This will be going into the Blogger HTML/Javascript Widget tool, so... yeah.) Hi All, This is my first post and I need some assistance. I'm learning code and attempting to put more than 1 script on a webpage, but individual (separate pages) but together, neither one works. I'm a newbie and my professor doesn't know how to teach so it's me trying to do this myself and any assistance will be helpful. This is what I have (trying to add random pictures and a cycling banner) <script> var imgArray = new Array (4); var index = 0; function cycle () { document.banner.src = imgArray[index].src; index++; if (index > 3) { index = 0; } setTimeout("cycle()", 2000); return; } function startup () { imgArray[0] = new Image; imgArray[0].src = "Im.png"; imgArray[1] = new Image; imgArray[1].src = "Tired.jpg"; imgArray[2] = new Image; imgArray[2].src = "of this.jpg"; imgArray[3] = new Image; imgArray[3].src = "Rainy.jpg"; cycle(); return; } </script> </head> <body onLoad="select();startup()"> <div align="center"> <img name="banner" src="Im.png"> </div> </body> </body> <script> var imgArray = new Array (5); var index = 0; function select () { index= Math.floor(Math.random() * 5); document.banner.src = imgArray[index].src; setTimeout("select()", 2000); return; } function startup () { imgArray[0] = new Image; imgArray[0].src = "1.jpg"; imgArray[1] = new Image; imgArray[1].src = "2.jpg"; imgArray[2] = new Image; imgArray[2].src = "3.jpg"; imgArray[3] = new Image; imgArray[3].src = "4.jpg"; imgArray[4] = new Image; imgArray[4].src = "sheep.jpg"; select(); return; } </script> </head> <body onLoad="cycle(); startup()"> <div align="center"> <img name="banner" src="1.jpg"> </div> </body> OK, I programmed most of my page, but not all of it, not the CSS or Javascript. On all the individual HTML pages, it shows Done but with errors. Here is the error. Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.2; Alexa Toolbar) Timestamp: Sat, 18 Dec 2010 05:18:55 UTC Message: Invalid argument. Line: 4 Char: 116 Code: 0 URI: http://www.addyourl.com/convergance/nym6pbs.js Now, the addyourl site is mine too and I put it there because I want my page to load quicker and everything that I do to make it load quicker suggest combing CSS sheets and Javascript files, but whatever the case, I don't have the technical ability to do that. My webpage is: www.fkcapitalfund.com So, I can't fix that error, I don't have the technial wherewithal to do it and the person who did the programming won't help anymore, he made the template for me and left me to my own devices unfortunately. Along the same lines as this, my goal is to get my page to load quicker and my appealing to google Any help to that end would be appreciated. Thanks Alright so I've been teaching myself php/javascript/html/joomla for the past couple weeks, learning as i go along. So bear with me if i seem like a total moron =p. I'm trying to run a script from a js file to add javascript to the website inside the iframe. I also would like the script to only be activated onclick(this is all in an article). To clarify my website has an iframe and this iframe contains a webpage from http://website987.com/. I want to run thescript.js on the website inside that iframe, to add javascript to that website, however i also only want to run this js file on the click of a link/button. I hope i'm being clear if I'm not please tell me and ill try to reiterate. I've been trying to get this to work for a while now and I feel like this is really simple and I'm asking a stupid question. However this is what I've got so far, currently this just redirects the iframe to the URL with my code on it(instead of actually running it).How could i edit this/what coding could I use to make it so thescript.js actually runs instead of it being just redirected? Reply With Quote Code: <?php $filename = 'thescript.js'; $path = '/media/system/js/'; // add the path parameter if the path is different than : 'media/system/js/' JHTML::script($filename, $path, true); // MooTools will load if it is not already loaded ?> Code: <HTML> <HEAD> <script language="javascript"> function loadOne() { parent.FRAME1.location.javascript: function('/media/system/js/thescript.js') } </script> </HEAD> <BODY> <iframe name="FRAME1" src="http://website987.com/" width="740" height="500" frameborder="0" scrolling="yes"></iframe> <a href="javascript:loadOne()">Click Here/a> </BODY> </HTML> Am i even on the right track? I've been testing out a billion different codes and I think it would be ridiculous to post them all so I was hoping someone could help me fix this code or at least point me in the right direction. I'm usually able to figure everything out on my own but I'm failing atm and I just need help on this one thing, I would be ever so thankful for any assistance provided, ! (BTW I'm also currently using the Joomla CMS and a joomla plugin called CodeMirror that runs your code directly from the article, not sure if this is relevent or not) I have a JavaScript drop down menu and just under it is the slide show also using JavaScript.Now when I you select the menu the drop down contents are hidden behind the slide underneath it .But if it is a still image,they appear on top of the image. I need the menu the drop down contents to appear on top on the slide show. How can I achieve that. Hi, I want to when I open a web page , my program detect all the "digit numbers" and display all of them for me. I don't know exactly what do I do? Thanks. Regards. How do you make an ios5 type notification system with javascript for your webpage?
how can I display the same Javascript Graph more then once on the same HTML page. Everytime I add another graph using the same code on the same HTML page only one graph will show. Here is the code that I have: <html> <head> <title>Graph</title> <body> <title>Data</title> <p align="center"> </p> <p align="center"><font size="4"><b>test</b></font></p> <center> <script type="text/javascript" src=".\JavaFiles\wz_jsgraphics.js"> </script> <script type="text/javascript" src=".\JavaFiles\line.js"> </script> <div id="lineCanvas" style="overflow: auto; position:center;height:300px;width:800px;"></div> <script type="text/javascript"> var g = new line_graph(); g.add(' 1.0',197); g.add(' 2.0',721); g.add(' 3.0',852); g.render("lineCanvas","test"); </script> <p align="left"><font size="2"><b>Test </b></font></p> </body> What can I do to fix that. Thanks Hello, First, I'm new to the Javascript (and to this forum). I am trying to use a Javascript to display a randomly selected image located in a folder of my site. I need to fit these images (which may have quite diverse dimensions) into a frame of 280x280 px. Here is the code of the current script which does not currently work: Code: // JavaScript Document <script language="JavaScript"><!-- function random_imglink(){ var myimages=new Array() var imagetitle=new Array() urlimage="http://www.mysite.fr/Images/RandomPictures/" var i=0 //specify here the total number of random images which should be names 1.jpg, 2.jpg etc nbrandompic=140 for (i=0;i<= nbrandompic;i++) { myimages[i]=urlimage + i +".jpg" imagetitle[i]=urlimage + i +".txt" } //Randomly select an image var ry=Math.floor(Math.random()*myimages.length) if (ry==0) ry=1 var reduction = 1 var maxWidth=280 var maxHeight=280 //Calculate the reduction that should be applied if(myimages[ry].width > maxWidth || image.height > maxHeight) reduction = Math.max(myimages[ry].width/maxWidth,myimages[ry].height/maxHeight) // New dimensions iw = Math.round(myimages[ry].width / reduction) ih = Math.round(myimages[ry].height / reduction) //Display image document.write('<a><img src="'myimages[ry]'" title="" border=0 width='+iw+' height='+ih+'></a>') } random_imglink() //--> </script> I am sure that you guys can help me solve this problem. Many thanks in advance!! Antonino Doing some forum searching, I found the following code: Code: <div id="someThing" style="display:block" >Put something here.</div> <script type="text/javascript"> var nowUrl = location.href; if (nowUrl != "http://jemmakidd.com/categories.php") { document.getElementById("someThing").style.display="none"; } </script> Apparently, this is for use of when you are modifying, for example, a PHP header or footer displayed on every page and you only want something to show up on particular pages. My issue is that I am trying to put something in the header of a Tumblr blog, and I only want it to show on the post pages. The Tumblr main page format is: http://*.tumblr.com/ The Tumblr post page format is: http://*.tumblr.com/post/* Is there any code I can use to do this? Hi guys, I am new to this forum and I am sorry if this is not the right section to post this. Please move this to the appropriate section. I am rather new to HTML and Javascripting and am currently developing an Intranet Webpage. On one of the pages, I am required to update the contents of the webpage using a .csv file which will be uploaded to the server on a daily basis. I have learnt that it is possible to update the contents using "Tabular Data Control" to display the contents and update it regularly. I am also reuqired to change an images according to content in the table. However, I am only able to retrieve the first row the the table and therefore would like some assistance to help retrieve the subsequent rows. Here are my codes: Codes for the .csv/.txt files Code: Name,Status Item #1,Completed Item #2,Pending Item #3,Not Started Item #4,Completed Item #5,Completed Item #6,Pending HTML codes: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body onLoad="loadStatus()"> <script type="text/javascript"> function loadStatus(){ var textField = document.getElementById("test").innerText alert(textField); if(textField == "Completed") { document.getElementById("pic").src = '/images/completed.jpg'; } else if (textField == "Pending") { document.getElementById("pic").src = '/images/on-going.jpg'; } else if (textField == "Not Started") { document.getElementById("pic").src = '/images/not_started.jpg'; } } </script> <OBJECT ID="data" CLASSID="CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83"> <PARAM NAME="DataURL" VALUE="test.txt"> <PARAM NAME="UseHeader" VALUE="true"> </OBJECT> <table border="1" bordercolor="#000000" cellpadding="0" datasrc="#data" > <THEAD><TR> <TBODY> <TR> <TD><img src="" width="14" height="14" id="pic"></TD> <TD><div datafld="Name"></div></TD> <TD id="test"><span datafld="Status"></span></TD></TR> </TBODY> </TABLE> </body> </html> I have thought of adding 6 different <object> and 6 <span> using filter to filter each object according to their name. But it would be very messy and would make the page bigger in size. I hope you guys can help me. Thanks in advance. Cheers, Jermms |