javascript

PHP or Ruby on Rails for interactive community site?

I consider myself as an entrepreneur with basic programming skills. My main experience is with PHP, but mostly as a code breaker- meaning being able to figure out the basics and manipulate the code to my needs. Recently took up studying RoR and it seems easy to understand. I will be putting together some resources to build a niche socia...

Javascript function parameters

Hello, I am working on a project which involves the ExtJS library and I came upon this piece of code which did not make sense (but it works). Please help :(. TreePanel.on('click', showDocumentFromTree); function showDocumentFromTree(node) { if (TreePanel.getSelectionModel().isSelected(node)) { dataStore.baseParams = { ...

Ajax Returns Random Values?

I am working on a simple AJAX page. when the page loads, it should take the result from the PHP page and display it in the text box. If the result is "1" (which it should be), then it should pop up an alert saying "Ready." Main page's code (t1_wait.php): <html><head><title>Waiting...</title></head><body> <script type="text/javascript"...

How do you reverse a string in place in JavaScript?

How do you reverse a string in place (or in-place) in JavaScript when passed to a function with a return statement? All without using the built-in functions? .reverse(), .charAt(), etc. Thanks! ...

Are variables statically or dynamically "scoped" in javascript?

Or more specific to what I need: If I call a function from within another function, is it going to pull the variable from within the calling function, or from the level above? Ex: myVar=0; function runMe(){ myVar = 10; callMe(); } function callMe(){ addMe = myVar+10; } What does myVar end up being if callMe() is called t...

Frame Buster Buster ... buster code needed

Let's say you don't want other sites to "frame" your site in an <iframe>: <iframe src="http://yourwebsite.com"&gt;&lt;/iframe&gt; So you insert anti-framing, frame busting JavaScript into all your pages: /* break us out of any containing iframes */ if (top != self) { top.location.replace(self.location.href); } Excellent! Now you "b...

Is submitting a form in javascript significantly faster than server-side submitting?

I was told that using javascript to submit in either asp or asp.net causes a faster submit. Is this true or is there no significant difference? ...

How to print a very large image that is on the web page using JavaScript

I want to print a very large image generated by my program with 31279px in width with javascript but window.print() prints only a little part of the entire image. Please any solution to this? ...

Increasing Page Height With Javascript.

Hi, I dont know anything about javascript but I want to be able to click on an Image and increase the page size. Example. A 500px x 500px box with an image in it. When you click on an image the box will increase to 500px x 1000px with new content within the new area without it changing the page. How would I do this? Like On This Webs...

Safest way to remove unwanted whitespace

Hi I have this HTML string which often has a lot of whitespaces Example: <p>All these words <br /> <strong>All</strong> <em>these</em> words <pre> All these words</pre> </p> I need to remove them using JavaScript, and have come up with this regEx: String.replace(/ {2,}/g, ''); Which seems to do the job with replacin...

Dealing with expandable jQuery content if javascript disabled

I have a messaging tool within the website I am currently working on. The idea is to have a header div and a details div (display="none") for each message. Ideally, if javascript enabled, I have just the header showing and when the user clicks on it, the details div slide open. This is fine but how should I work it if javascript is ...

Web IDE tool

Does anyone know if it exists a Web IDE allowing to develop web application directly from a web application? The W3School website allows to write small piece of code in HTML or javascript but is there another solution more project oriented? ...

Stupidly easy JS variable passing issue...i think.

I have an XHR call getting a date for me, but can't seem to pass it into the page - i know its school-boy stuff, but its driving me mad. I just need to pass the date from the XHR call to a variable to be inserted via document.write... Anyone ? thanks in advance. B var upDated function getUpdated(){ xmlhttp.open("HEAD", "MBP_box...

Generic way to detect if html form is edited

I have a tabbed html form. Upon navigating from one tab to the other, the current tab's data is persisted (on the DB) even if there is no change to the data. I would like to make the persistence call only if the form is edited. The form can contain any kind of control. Dirtying the form need not be by typing some text but choosing a dat...

Optimize javascript pre-load of images

I was wondering if anyone has any strategies for optimizing the pre-loading of images via javascript? I'm porting a Flash application into html/css, attempting to recreate the UI as close to the original site as possible. It's essentially a photo browser application, where a high-res image is shown when the user hovers over a link. Ther...

Regex in Javascript to remove links

Hello, I'm really sorry if this has been answered before but I just can't seem to find the proper answer. I have a string in JS and it includes an href tag. I want to remove all links AND the text. I know how to just remove the link and leave the inner text but I want to remove the link completely. For example: var s = "check this out...

Playing a sound file (.wav) results in beep if subsequent sound played too fast

I'm using JavaScript to play a sound file. If I play the sound file (using JavaScript) twice in quick succession then instead of hearing the sound file again the second time I hear a bell. Why would I be hearing a bell instead of the sound file? Is there a way to prevent the bell from sounding? (This JavaScript is not running in a brows...

Microsoft Script Editor (MSE) download

A while back i saw a link on here which let you download an installer for MSE. I should have copied it down but i didnt. Now i really need it. I know that it comes with office 2002, but i cant install that right now. If someone has a link please share it. I think its easy to find if you know the file name, which i dont. ...

window.open() returns undefined or null on 2nd call

I have the follow scenario: I click a link which: opens a popup window called 'popup' which loads a pdf inside of it (in IE6). without closing the popup, i click the link again, which should reopen the pdf inside the popup, but instead a javascript error in thrown: member not found the javascript function used to open the popup is: f...

When a Flash applet loses focus, how can I catch that event in JavaScript?

How do I get a JavaScript event when a Flash movie loses focus? eg. like when the user clicks the HTML page. ...