javascript

How do I do a list of items in Jquery and get it on server side ?

I'm trying to make a list of items (telephones and dependents for a customer), for example, the user could include some number phones and remove others (maybe edit them if it is possible), like a list inside the record of customer. I'd like to know how can I do it on client side and get the list in server side ? Is there a jquery plugi...

JQuery printfunction: no content, no view

I got a JQuery printfunction: function doPrintPage() { myWindow = window.open('', '', 'titlebar=yes,menubar=yes,status=yes,scrollbars=yes,width=800,height=600'); myWindow.document.open(); myWindow.document.write(document.getElementById("studentnummer").value); myWindow.document.write(document.getElementById("Voornaam").v...

How to call iframe's function from this iframe

Hi, I have an iframe created in Javascript with some function f(): var iframe = document.createElement("iframe"); $(iframe).attr({ width: 0, height: 0, frameborder: 0, src: this.options.url, name: id, id: id }); document.body.appendChild(iframe); iframe.contentWindow.f = function(data) { alert("test"); }; Document load...

Javascript: replacing newlines with <br/> working in FF and SAFARI and not working in IE

Code in the post has been modified. I was thinking that replacing \n with with javascript was quite a simple task, but it seems not to be so. Posts in Ask Ben or StackOverflow suggest that something as simple as: var myRe = new RegExp(/\r?\n/g); // to avoid the re literal caching problem lDes = $("div.descr").html(); lDes = lDes.repl...

How can I make my javascript chat polling script be more efficient?

For some reason this check for new chat messages causes a larger amount of browser (and to some extent server) load than I would expect. Anyone see any ways that I can make it more efficient, to lessen the load? // Begin the cycle of refreshing the mini chat after the standard delay. function startRefreshingMinichat(){ var secs = 3...

window.location.href not working in Safari when using onkeypress

I'm using an asp textbox and a search button. In Safari if I click the search button i get redirected to the search results page using javascript window.location.href. But strangely the same javascript will not redirect to the page if I press return in the textbox. Using the alert function I can see that window.location.href has the th...

Common constants file for PHP and JavaScript

How do guys suggest to share a constants file between PHP and JavaScript, in order not to repeat code? XML file? I am assuming mixing up javascipt inside PHP would not be the right solution!? Thanks ...

JavaScript two-dimensional Array to PHP

Hi I have to send a two-dimensional JavaScript Array to a PHP page. Indeed, I'm working on a form-builder, in which the user can add or remove fields. These fields are added (or removed) using JavaScript (jQuery). When the user is done and hit a 'publish' button, I have to get all the fields concerned and send them to a PHP page which w...

XSS attack prevention

Hi, I'm developing a web app where users can response to blog entries. This is a security problem because they can send dangerous data that will be rendered to other users (and executed by javascript). They can't format the text they send. No "bold", no colors, no nothing. Just simple text. I came up with this regex to solve my problem...

Allow only certain domains being able to load an iFrame

I'm building some widgets for a charity. Due to some logo licensing malarkey, I've got to find some way of only allowing white-listed sites from running the code, or to send a error message (or something like that) rather than the widget. We've got to use iFrames as a fair few sites have already embedded them. Ideally, a PHP solution wo...

problem on running script on different operating system

i run use a javascript code for getting browser information it run fine on microsoft windows xp but it not working on microsoft windows server 2003. my code is folowing. plz help. <html> <head> <script type="text/javascript" src="zeroclipboard/ZeroClipboard.js"></script> <script type="text/javascript"> wind...

JavaScript: String Concatenation slow performance? Array.join('')?

I've read that if I have a for loop, I should not use string concation because it's slow. Such as: for (i=0;i<10000000;i++) { str += 'a'; } And instead, I should use Array.join(), since it's much faster: var tmp = []; for (i=0;i<10000000;i++) { tmp.push('a'); } var str = tmp.join(''); However, I have also read that string c...

CKEditor disable HTML transformation

I've got a problem with CKEditor. Especially the br- and img-Tags are transformed to not be valid. In the source-view I see and but when I inspect the rte-source the slashes are gone as well as when submitting the form. Can someone tell me where I can disable this or enable XHTML-conformity? The embedding page is XHTML. Thank to any h...

How to fix the size of the printing area while using window.print?

Hi I'm creating a invoice and have option to print the invoice. While printing i use a stylesheet (using media=print) to block the display of elements which should not be printed... But while printing it takes the full size of the window and uses that much paper.. I want to restrict the size of the printing area.... How can i do that...

Creating a link button and an image button in ExtJS?

Hi, I want to create a link in ExtJS, but one that is made of button, so, that it contains event handlers (and I don't need to add my own event handlers.) Also, I would like to create a button that does display a big icon with text like: ICON TEXT so that the icon is not positioned on the left side, but on the top (and is larger than ...

Updating Embedded Video in Firefox

I am working on a Videos page where my intention is to load a video with the page but by clicking a link, the original video will be updated and replaced with the corresponding video. For instance, if video1 loads with the page and the user clicks to view video2, the original div's innerHTML holding video1 is updated to play video2. No...

Site monitoring tool to look for javascript errors

I am currently working on a site that includes javascript code that we get from several different sources and need to run on the site I maintain. Every once and a while some of this code breaks without our knowing until its too late. Is there a monitoring tool that will crawl our site and look for javascript errors and report them or cou...

Javascript serialization

Have I any chance to serialize meta (any format, so I can store it in DB)? var obj1 = {}; var obj2 = {}; obj1.link = obj2; obj2.link = obj1; var meta = [obj1, obj2]; As I understand the problem is that JSON serialize object`s links to objects. ...

Marquee horizontal text scroll with a fading effect?

I am looking for a solution for a single line Marquee horizontal text scroll with a fading effect using javascript (jquery if possible). Like a carousel text scroll. All the google searches gave me scrolling effects but with no fading effect. I know that this can be done in flash but im avoiding it if there are other solutions. Any he...

JavaScript DOM: transfer element between frames

I'm using the following jQuery code within an iframe (same origin) to try to move a node from the iframe to the main (top) document. var dest = $(window.top.document).find('#dest_id'); dest.append($('#source_id')); The following works ok: window.top.document.getElementById('dest_id').innerHTML = document.getElementById('source_id').i...