Is JavaScript able to send/listen for data on a specific port? I'm seeking
a solution to real time data interaction with my web server that doesn't
require refreshing the page. I.e., a chat room, where the data can be
broadcast from the server arbitrarily and displayed by the client
browser(s). To accomplish the data transmission can I use JS, or do I need
to augment my client-side platform to something like Java, et al?
I have been directed from .NET section to this section. My original post and question are here. forums.devshed.com/net-development-87/asp-net-how-to-send-data-to-parallel-port-600691.html
Is it possible to send data to parallel port using javascript?
I was wondering if it is possible to set up some javascript to listen to changes to html - i.e. when html is done loading in a div via innerHTML, or through the javascript dom (an event attachment, not manual), or through some other means of dynamic html.
I know a lot of ways of accomplishing dynamic html, this is just about how to attach an event listener or some handler to a component to react to a change in its children dom. Let me know if you are still unsure what I am wanting to do..
Basically, I want to have a javascript that will watch for data coming in on a specific port - like HTTP on port 80, etc. Is this at all possible with pure javascript?
I'm a newbie to javascript programming and I'm seeking on a solution on how to connect to a tcp port using javascript. Basically, we have phone server that is constantly streaming XML data on port 1024 (serverIP:1024). I've ran a packet sniffer and was able to gather the elements and attributes for the XML data that the server is streaming. Now, I have a test XML parser which works with the XML document using the elements and attributes i've gathered from the packet sniffer. Is there a way for me to connect to the TCP port i've mentioned using javascript and incorporate it with the XML parser that I have. code...
Okay, this an attempt to port PHP's date() function as much as possible to JavaScript. Could use some refactoring though. Any critique, comments, appraisal and any other opinion is very welcome. Feel free to discuss and also take a look at beetles code here: http://www.codingforums.com/showthread.php?s=&threadid=11069
Oh, and the date() function is described here: http://www.php.net/manual/en/function.date.php
Date.prototype.format = function (formatStr) { var heap = formatStr.split(""); var resHeap = new Array(heap.length); var escapeChar = ""; // you can change this to something different, but // don't use a character that has a formatting meaning, // unless you want to disable it's functionality
// go through array and extract identifiers from its fields for (var i = 0; i < heap.length; i++) { switch(heap[i]) { case escapeChar: resHeap[i] = heap[i+1]; i++; break;
case "a": // "am" or "pm" var temp = this.getHours(); resHeap[i] = (temp < 12) ? "am" : "pm"; break;
case "A": // "AM" or "PM" var temp = this.getHours(); resHeap[i] = (temp < 12) ? "AM" : "PM"; break;
case "d": // day of the month, 2 digits with leading zeros; i.e. "01" to "31" var temp = String(this.getDate()); resHeap[i] = (temp.length > 1) ? temp : "0" + temp; break;
case "D": // day of the week, textual, 3 letters; i.e. "Fri" var temp = this.dayNames[this.getDay()]; resHeap[i] = temp.substring(0, 3); break;
case "F": // month, textual, long; i.e. "January" resHeap[i] = this.monthNames[this.getMonth()]; break;
case "g": // hour, 12-hour format without leading zeros; i.e. "1" to "12" var temp = this.getHours(); resHeap[i] = (temp <= 12) ? temp : (temp - 12); break;
case "G": // hour, 24-hour format without leading zeros; i.e. "0" to "23" resHeap[i] = String(this.getHours()); break;
case "h": // hour, 12-hour format; i.e. "01" to "12" var temp = String(this.getHours()); temp = (temp <= 12) ? temp : (temp - 12); resHeap[i] = (temp.length > 1) ? temp : "0" + temp; break;
case "H": // hour, 24-hour format; i.e. "00" to "23" var temp = String(this.getHours()); resHeap[i] = (temp.length > 1) ? temp : "0" + temp; break;
case "i": // minutes; i.e. "00" to "59" var temp = String(this.getMinutes()); resHeap[i] = (temp.length > 1) ? temp : "0" + temp; break;
case "I": // "1" if Daylight Savings Time, "0" otherwise. Works only on the northern hemisphere var firstDay = new Date(this.getFullYear(), 0, 1); resHeap[i] = (this.getTimezoneOffset() != firstDay.getTimezoneOffset()) ? (1) : (0); break;
case "J": // day of the month without leading zeros; i.e. "1" to "31" resHeap[i] = this.getDate(); break;
case "l": // day of the week, textual, long; i.e. "Friday" resHeap[i] = this.dayNames[this.getDay()]; break;
case "L": // boolean for whether it is a leap year; i.e. "0" or "1" resHeap[i] = (this.getFullYear() % 4) ? false : true; break;
case "m": // month; i.e. "01" to "12" var temp = String(this.getMonth() + 1); resHeap[i] = (temp.length > 1) ? temp : "0" + temp; break;
case "M": // month, textual, 3 letters; i.e. "Jan" resHeap[i] = this.monthNames[this.getMonth()]; break;
case "n": // month without leading zeros; i.e. "1" to "12" resHeap[i] = this.getMonth() + 1; break;
case "O": // Difference to Greenwich time in hours; i.e. "+0200" var minZone = this.getTimezoneOffset(); var mins = minZone % 60; var hour = String(((minZone - mins) / 60) * -1);
case "r": // RFC 822 formatted date; e.g. "Thu, 21 Dec 2000 16:01:07 +0200" var dayName = this.dayNames[this.getDay()].substr(0, 3); var monthName = this.monthNames[this.getMonth()].substr(0, 3); resHeap[i] = dayName + ", " + this.getDate() + " " + monthName + this.format(" Y H:i:s O"); break;
case "s": // seconds; i.e. "00" to "59" var temp = String(this.getSeconds()); resHeap[i] = (temp.length > 1) ? temp : "0" + temp; break;
case "S": // English ordinal suffix for the day of the month, 2 characters; i.e. "st", "nd", "rd" or "th" var temp = this.getDate(); var suffixes = ["st", "nd", "rd"]; var suffix = "";
case "t": // number of days in the given month; i.e. "28" to "31" resHeap[i] = this.getDay(); break;
/* * T: Not implemented */
case "U": // seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) // remember that this does not return milisecs! resHeap[i] = Math.floor(this.getTime() / 1000); break;
case "w": // day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday) resHeap[i] = this.getDay(); break;
case "W": // ISO-8601 week number of year, weeks starting on Monday var startOfYear = new Date(this.getFullYear(), 0, 1, 0, 0, 0, 0); var firstDay = startOfYear.getDay() - 1;
case "y": // year, 2 digits; i.e. "99" resHeap[i] = String(this.getFullYear()).substring(2); break;
case "Y": // year, 4 digits; i.e. "1999" resHeap[i] = this.getFullYear(); break;
case "z": // day of the year; i.e. "0" to "365" var firstDay = Date.UTC(this.getFullYear(), 0, 0); var thisDay = Date.UTC(this.getFullYear(), this.getMonth(), this.getDate()); resHeap[i] = Math.floor((thisDay - firstDay) / (1000 * 60 * 60 * 24)); break;
case "Z": // timezone offset in seconds (i.e. "-43200" to "43200"). resHeap[i] = this.getTimezoneOffset() * 60; break;
I have a UL that loads in dynamically after the DOM has already finished loading via and external API that doesn't have a callback function for when it's finished. However, I need to manipulate the children of the UL once it's loaded in, so I need some type of listener for when the UL changes.I need an event to fire when an element or it's children change.Is there anything like this in jQuery? Otherwise I'm going to have to create a setInterval to polloccasionallyto see if the UL has loaded, and that sounds sloppy.
I have a function that defines the height of a div based on a table's height. if the page is made tight, the table will be longer, howerever the div is the original size as when the page loaded. is there a way for me to listen for a browser resize and if it were, run my div size function?
I know about the same-origin policy and that one of the only ways to load data from a cross-domain is to load it as JSON. However, all I am trying to do is access data from a server on another port (which I believe the browser still treats as cross-domain). I need to do this because the server my application is on is a map server and the other server (Apache) is the only one that can handle php scripts. I have also tried out the plug-in from [URL] and while it works when I do $('#phpContent').load('http://www.google.com'); it doesn't work when I try $('#phpContent').load('http://localhost:80/mapScripts/getFiles.php'); I have also tried$.get('http://localhost:80/mapScripts/getFiles.php', function(data) { $('#phpContent').html(data); });
So here I am breaking my brain and do not know what else to attempt.
I have created a payment system using Jquery. The problem I run into is when I move from http to https. I get the following error: Error: [Exception... "Access to restricted URI denied" code: "1012"
I am preparing a log for all the elements that have been selected in a document.
So I have to listen to the onmousedown,onclick events on parent document from a iframe and have to display the selected element's attributes like(tag name, id, name etc).
Is there a way to listen the mouse events (infact all the events) from the iframe.
Hides the element by sliding it down. $("div").click(function () { $(this).hide("slide", { direction: "down" }, 1000); }); I am new to Jquery. How do I reverse this code to slide element into viewport as opposed to slide out of view port. This is the link to the effect [URL]. What I want to do is the element will be hidden originally on loading the page and then slides into view with a click anywhere on the page, an anchor or after a few seconds.
I am working on a robot project, that is required to create a website to control the robot via serial port.. The website is plainly html, no linking to database is needed...
I have no idea how and what language to use and can JavaScript communicate with serial port? and how?
I'm trying to find the position of an element with respect to the view port area. So, when the user scrolls the page down, I want to know the x and y positions of the element with respect to the viewing (view port) area.
The overall goal is to know exactly where on the element this user clicked.
My apologie for the spam, but I have another question that I can't seem to find an answer for. Using .live(), I know we can have the engine listen for events that will be triggered on elements that are to be created still. I'm currently looking for a way to automatically execute javascript code on elements when they are created Is that something that is supported with .live()?
I'm working on a site hosted through a blog-managing company. Sometimes their programming doesn't seem to let me do things that would normally be possible, so I have to find creative work-arounds.
This time, It doesn't seem I can use javascript to change an href destination that is generated by their system. I want the user to go to a different page, when they click on that link.
I can have a script find a specific href, but it can't change it for some reason. So I'm wondering if there's a way I can just have the script redirect the user if they click on that link? I know it seems like a long way round, but I don't see any other way to do this under the circumstances.
Here's what I thought would work, but didn't: document.getElementById('elementName').href == [url]
I am trying to set up a five star rating system, I found a stock framework that I am adding to but I ran across a problem.
I cannot get the rating "number" to pass through the AJAX get call:
Code:
/* Author: Addam M. Driver Date: 10/31/2006 */
[Code]....
The problem is in the sendRate function. It has the variable sel passed into it, and if i try to send sel.title it passes the title according to what the user selects, however, if i try to just pass the "sel" it doesnt get through..
how to send the value of "sel" variable to me perl script?