javascript

Javascript String.replace with dynamic regular expressions?

I have the following code, which works, but I need to inject some different stuff into the regular expression object (regex2) at runtime. However, text.replace does not seem to like a string object for the regular expression, so how can I make this work? var regex2 = /\|\d+:\d+/; document.write("result = " + text.replace(regex2, '') + "...

manipulating textbox value

hello All, I am new to the programming world of dojo and web applications. I am trying to acomplish a task where I want to manipulate the textbox value with some text. I tried everything including some code from dojocampus, but even this code doesnot do anything. I have also tried to create an instance , with dojo.widget.byId and dijit....

WORDPRESS: Hacking Comment Form to act like Tell a Friend

I have a client that is using WP for a CMS. He wants un-registered users to be able to submit content. It's a form that has the following fields: Your name Your email Friend's name Friend's email Message Submit Then the message would be posted on the site (as a comment) and that message/comment would then be emailed to the Friend's ema...

How to quickly and conveniently disable all console.log statements in my code?

Is there any way to turn off all console.log statements in my JavaScript code, for testing purposes? Thanks! ...

How do I get the value of td using hierarchy?

<tr> <td>#</td> <td>2009</td> <td><a class="delete_this">Click</a></td> </tr> I want to use jquery and get the text of 2nd (second) "td" when clicking the anchor. I want the "td" in the same tr as the anchor... How do I do this? So far I have $(document).ready(function(){ $(".delete_this').click(function(){ var myNUmber = $...

Implementing client-side ajax login, is it safe to logout using ajax or do I need to refresh?

I'm building a client-side ajax login for Asp.Net MVC by doing jquery posts to the controller to log in the user. What I'm wondering is when the user goes to log out, should the page refresh? (for security reasons) This tutorial here says: There will always be a page refresh on logout. This is necessary to ensure that any user...

How can I get class-based objects in JavaScript with jQuery?

I'm trying to move from Prototype to jQuery and there's one last thing I can't figure out how to do in the new library. Here's what I used to do with Prototype: MyClass = Class.create(); MyClass.prototype = { initialize: function(options) { } } Then I could create a new MyClass with: var mc = new MyClass({}); Does jQuery have...

How do you make a web page change without reloading the page?

What should I look into to accomplish this. When you select an input field some text to the right shows up. For example: https://twitter.com/signup Anyway i need something like that works with PHP. What should I look in to? And also How can you query the database and not have to reload the page to see result? For example i have seen ...

Will a disabled text field submit when a form is POSTed?

If I submit a disabled text field via POST, what will the resulting value be on the action page? For example, I have: <table border=0 cellpadding=4 cellspacing=0> <tr><td> <input type="checkbox" id="chk_$item" onClick="javascript:handleClick('$item')"> </td><td> <input type="text" id="txt_$item" name="addresses[]" value="$it...

Search engine woes

I have been trying to make this search engine for a MySQL database. Taking in user input is no problem, database querying is also fine. One thing I need to figure out is this: I am a string in the database How do I match the input "AM", but keep the same case? There are PHP functions like str_ireplace or preg_replace/eregi_replace...

Unable to communicate with Javascript from Flex after dymanically loading a swf.

Hi, for some reason, whenever I dynamically load a swf on a $(document).ready() by writing to a div, I am unable to make javascript calls to the browser. Specifically, all calls to the browser return "null". This does not occur when embedding the swf normally on the page load, but I would like to prevent loading of the swf until a specif...

How can I hook up facebook connect with our site's login?

I want to implement something similar to what Digg has done. When the user logs in for the first time, I want it to force them to create an account on my site. More importantly I want to know how to log a user into my site when they login with facebook connect. If they login with facebook connect, they still haven't provided me the pa...

Passing objects from Rails RJS to a javascript function call without quoting the values?

In a Ruby on Rails project I need to have a JavaScript function executed at the end of an Ajax call. My problem is that the values being passed into the JavaScript function being called with page.call are being wrapped up in quotes. Not too much of a problem if you're passing in strings but one of the values is a string representation of...

Grab File Upload ASP Object Textbox Text with jQuery

I have a webform that has an ASP file upload object and I want to use jQuery to grab the file they have selected and upload the file via AJAX. However I am having problems grabbing the file name after it's been selected. Here is the HTML/ASP Code: <asp:FileUpload runat="server" ID="NewPic" /> <asp:RequiredFieldValidator ID="Requir...

Do all J2ME phones support JavaScript?

Are there any J2ME phones that don't support JavaScript? And are there generally limitations on the JavaScript that is supported / portions of the language that aren't implemented? ...

Surrounding all instances of @________, #___________, and http://_________ with anchor tags?

Related (but slightly different): http://stackoverflow.com/questions/1181204/javascript-regex-surround-and-http-with-anchor-tags-in I would like to surround all instances of @___, #____, and http://________ with anchor tags. Multiple passes is fine with me. For example, consider this Twitter message: The quick brown fox @Spreadt...

how can I make a div stick to the top of the screen once it's been scrolled to?

I would like to create a div, that is situated beneath a block of content but that once the page has been scrolled enough to contact its top boundary, becomes fixed in place and scrolls with the page. I know I've seen at least one example of this online but I cannot remember it for the life of me. Any thoughts? ...

Gaussian Elimination with custom operators

What is a good way to implement Gaussian elimination when the operators are custom operators, rather then standard arithmetic ones? Here are the operators: Addition: 0 + 0 = 0 0 + 1 = 1 1 + 1 = 0 Subtraction: 0 - 0 = 0 0 - 1 = 1 1 - 1 = 0 Multiplication: 0 * 0 = 0 0 * 1 = 0 1 * 1 = 1 Division: 0 / 0 = illegal 0 / 1 = 0 1 / 1 ...

javascript injection in wicket

I have J2EE project which uses wicket framework. I want to know how can I prevent from javascript injection in wicket? ...

Looking for a JS library to move text

Hi, I'm looking for a javascript library that will allow me to drag text over an image with some resize handles that will automatically wrap the text. I've tried doing some searches but don't think I'm using the right search terms. I'm hoping someone has come accross simliar functionality before. Thanks :) ...