javascript

submit form when elements change

In jQuery, if I assign class=auto_submit_form to a form, it will be submitted whenever any element is changed, with the following code: /* automatically submit if any element in the form changes */ $(function() { $(".auto_submit_form").change(function() { this.submit(); }); }); However, if I want to the form to submit only whe...

Encapsulation in javascript

Hello everyone! I need to create simple reusable javascript object publishing several methods and parameterized constructor. After reading through several "OOP in JavaScript" guides I'm sitting here with an empty head. How on the Earth can I do this? Here my last non-working code: SomeClass = function(id) { this._id = id; } (funct...

To Ajaxify Or Not?

I really love the way Ajax makes a web app perform more like a desktop app, but I'm worried about the hits on a high volume site. I'm developing a database app right now that's intranet based, that no more then 2-4 people are going to be accessing at one time. I'm Ajaxing the hell out of it, but it got me to wondering, how much Ajax is...

Activate Firefox tab in Greasemonkey/Javascript? Is this possible?

Hello, I developed a greasemonkey script that refreshes a page and checks for certain updates. I would like to run this script in a tab and browse the internet in another tab, but then have the script automatically activate it's tab when an update is found. Im not sure how clear that was, maybe this is better: Tab 1 is running a greas...

How do I close a firefox tab from a greasemonkey script?

I have a greasemonkey user script with this single line of code... window.close(); but firefox does not allow a user script to close a window (as reported by an error message in the error console) Is there a work around to this problem? ...

Can I disable SOP (Same Origin Policy) on any browser for development?

I want to develop JS on my windows machine. Do you know a browser where I can turn off SOP so I can develop? Firefox would be optimal. Or if you know a proxy I could use for a SOAP/WSDL site it would be great too.. I am trying to work with the SOAPClient (http://www.codeplex.com/JavaScriptSoapClient) ...

error outputting html with javascript

Hello, I have this php code, with which I am trying to generate a popup window that will contain the contents of a html file, however after adding in the script tags, no html is displayed. I tried echoing out $row2, but the word array is printed to the screen and nothing else. <?php session_start(); if (isset($_GET["cmd"])) $cmd = $_...

javascript not being output

I have this short code linked that is sent from a php file: { $sql="SELECT * FROM Auctions WHERE ARTICLE_NO ='$pk'"; $sql2="SELECT ARTICLE_DESC FROM Auctions WHERE ARTICLE_NO ='$pk'"; $htmlset = mysql_query($sql2); $row2 = mysql_fetch_array($htmlset); echo '<script> function makewindows(){ child1 = window.open ("about:blank"); child1.d...

How to resize html canvas element?

I have a canvas element defined statically in the html with a width and height. If I attempt to use JavaScript to resize it dynamically (setting a new width and height - either on the attributes of the canvas or via the style properties) I get the following error in Firefox: uncaught exception: [Exception... "Illegal operation on Wra...

parsing html <script> via PHP isn't working completely.

I find this very strange, must be something I'm doing wrong, but still... I'm working on a page using PHP and TPL files. In my TPL file, there's a place in the footer for some extra lines if needed. For instance, formchecking with Javascript. so in PHP I did this: $foot = "<script type=\"text/javascript\">if(document.getElementById){l...

How to pass array from Asp.net server side to Javascript function on client side

How do I pass an array I have created on the server side onto the client side for manipulation by Javascript? Any pseudo code will help ...

JavaScript edit-inplace-holders which work with Wiki sources

I'd like to dynamicly parse in text wiki-content. I found JsWiki but its in beta form, and looks like with no community even developers). Any other? ...

Why does my custom drag and drop script fail?

Hi all, I am currently trying to code my own JS drag and drop script (out of sheer curiosity and boredom, I know it would be much easier with a framework). My aim is a fully working FF3 version , IE can wait for now. I just got stuck on a weird bug. When I drag the div for the first time, it works ok. When I drag it for the second tim...

JavaScript Source Code Analyzer

Does anyone know of a good, extensible source code analyzer that examines JavaScript files? ...

Using javascript to set value of hidden field then access value from serverside c# code

Hi Guys I am using a nested html unordered list styled as a drop down. When the a tag within the inner lists list item is clicked it trigger some javascript which is supposed to set the value of a hidden field to the text for the link that was clicked. The javascript seems to work - I used an alert to read the value from the hidden fie...

Need help refining this javascript regex

I have the following very simple Javascript-compatible regular expression: <script type="text/javascript" id="(.+)" src="([^"]+)"> I am trying to match on script tags and gather both the ID and src attributes. I'd like to make the order of the attributes irrelevant, so that the following will still match: <script id="..." type="text/...

How can I switch a text box for a <label>, <div>, or <span> using jQuery?

I'm trying to "single source" a form page which can be in edit mode or view mode. For various reasons, this isn't using the ASP.Net FormView or DetailsView controls. Since there is no way to disable a textbox without turning its contents gray (well, we could "eat" all of the keystrokes into it, but that isn't very elegant either) and di...

Loopback jQuery AJAX Request

What is the best way to build a loopback URL for an AJAX call? Say I have a page at http://www.mydomain.com/some/subdir/file.php that I want to load with an AJAX call. In Firefox, using jQuery this works fine: $.post('/some/subdir/file.php', ...); Safari/WebKit tries to interpret this as a location on the local filesystem (so it en...

Session management in GWT without using Java on the server?

I am using GWT for my client side application. I am not using GWT/Java for the server. However, I am not sure how I can handle session management. The GWT application resides on one page, all server calls are done via AJAX. If a session expires on the server... let's assume the user didn't close the browser, but left the application ...

How do I get the name of an object's type in JavaScript?

Is there a JavaScript equivalent of Java's class.getName()? ...