javascript

Change all links that have an image in it to: javascript(alert(thehref));

Change all links that have an image in it to: javascript(alert(thehref)); eg. <a href="/galleries/anna-leah-111827/image01.html"><img src="/source_galleries/anna-leah-111827/tn/01.jpg"></a> <a href="/galleries/23435/image01.html">ssss</a> becomes <a href="/galleries/anna-leah-111827/image01.html" onclick="alert(this.href)"><img src=...

jQuery datepicker listener options

My goal is to have a jQuery datepicker pop up when the user clicks a link, not a text box. Additionally, I was wondering if I can set up links from a given date (to list scheduled events). I've been attempting to modify the demo code on the jQuery demo site and others to fit these requirements, but I'm very unfamiliar with javascript a...

Does sIFR3 create issues on an already JS-library heavy website?

I am implementing a website and client wants sIFR3 font replacement. This site is already calling at least 6 different JS libraries to run a heavily-modded website. Will implementing font-replacement cause a huge load for the end-user? ...

Load a Javascript and execute it...

I have a website that loads once and then each time a user clicks a button instead of loading a new page, the content is just replaced via ajax. However on one of the pages I'm using jquery-ui and for example, if I land in "index.html" and then click to go to that page the script is not loading but if I go directly to that page the scrip...

Strange javascript addition problem

I have this code: var totalAmt=0; for (i in orders) { order=orders[i]; if (order.status !='Cancelled') totalAmt=totalAmt + order.amount; } But if i have 3 orders with amounts 3, 1, and 5, then instead of totalAmt being 9, i get 0315. So I think its adding the amounts together as strings instead of integars. How do I fix...

How to create similar behavior as Gmails Contact manager

Hi all, I would like to create something similar as Gmail's contact manager. I'm not very experienced with Javascript, I understand the basic concepts of AJAX and know my way around jQuery. But that is as far as it goes. Book/blog recommendations are greatly appreciated. Thanks! ...

Form gets submitted even if JavaScript fun returns false

Pls check code .html form gets submitted even if javascript returns false. <form id="form1" name="form1" method="post" action="sub.jsp" onsubmit="return getValue()"> <input type="text" id="userName" name="userName" onkeyup="return getValue()" /> <input type="submit" name="Submit" value="Submit" /> </form> <script type="text/jav...

How to remove a table row with jquery?

Hi I am having problems when it comes to removing a row from a table. I have 2 tables one requires me to delete X amount of rows so I used jquery.each and in the each loop I just went $(value).remove() and it works. Now I have another table where the user deletes one row at a time. So I thought I would do the same thing. ('#MyTable tb...

Best way to get the value of a given URL parameter with Javascript / jQuery?

Suppose you have a URL: http://www.example.com/whatever?this=that&amp;where=when How would you extract the value of the where parameter (in this case when)? This is what I came up with -- I'm wondering if there's a better solution: $.fn.url_param_value = function(param) { var url = $(this).attr('href'); var regex = new RegExp(pa...

How can I populate a javascript array with values from a database using PHP?

I have to create a javascript array whose elements are fetched by php from a database. Is it possible? If so, how? (I dont want to use ajax to do that) ...

JavaScript regex - check number of numeric-only matches

I have this regex thanks to another wonderful StackOverflow user /(?:-\d+)*/g I want it to match things like 133-134-454-58819860 12-13-876-1234346 each block (numbers between -'s) could be any length but it will defiantly only be numbers and there will only 4 blocks. But currently it's matching things like -2008 I'm really bad ...

Javascript add ID to HTML href.

Hi everyone, I have a livesearch script that i need to populate my html menu with information. i have a menu how looks something like this: <a href="?page=page&id=">Menu item</a> what i'm looking for is a piece of code that would do this to the link: <a href="?page=page&id=1">Menu item</a> i have a Javascript that pulls out value ...

How to display a message on the first press of a button?

Hi, I need to display the message with first time the button is pressed only. If I press the button again, it will redirect me. How to do in javascript? I have submit button, first time press button it will show the message. Pressing the same button the next time should NEVER SHOW the message, it should forward to the next page. Plea...

how to check if a file is selected using javascript?

if in php this is how you check if a file is selected: $_FILES['item']['size']>0 what about in javascript? i need to know because i have a function that will only work if a file is selected. ...

Canvas Animation Kit Experiment... ...how to clear the canvas?

I can make a obj to use the canvas to draw like this: MyObj.myDiv = new Canvas($("effectDiv"), Setting.width, Setting.height); Then, I use this to draw a rectangle on the canvas: var c = new Rectangle(80, 80, { fill: [220, 40, 90] } ); var move = new Timeline; move.addKeyframe(0, { x: 0, y: 0 } ); c.addTimeli...

JavaScript compression

I look for tool which can compress JavaScript source code. I found some web tools which only deletes whitespace chars? But maybe exist better tool which can compress user's function names, field name, deletes unused fields, others. ...

checking next page available before calling document.location (javascript)

I'm currently developing in a closed environment a web based "slide show" of sorts, using Javascript to move to the next slide (specifically document.location, after showing the current page for a delay of X seconds). An issue I'm having is that if the next page is for some reason offline, the entire slideshow breaks (page unavailable er...

How do I create a "todo" list for my web users to tick off?

Hello I'm trying to think of a way to create a list of items that I can display on a webpage that my visitors can tick off, without ever having to log in. The list may be like so: [ ] Buy potatoes [ ] Pickup kids [x] Drink more water [ ] Go for a Run If User A visits the site, and clicks "Drink More Water" I want that to sav...

HTML Entities with jQuery

I would like to use replace the value of a submit button with "Loading& hellip;" (without spaces). The problem is that when I click the button I still see "& hellip;" instead of three dots. Here's my code: $("#myid").val("Loading"); Should I enter the ellipsis directly from keybord in the code above? Is it safe with UTF-8? ...

How should I store a date in PHP for use with javascript?

What I want to do is make a script on the server read a text file, sort it, then output it to a javascript object (probably via JSON). The text file in question looks something like this: 13/09/2009,17/09/2009,Arbitrary dates 14/09/2009,18/09/2009,Some random comment 14/09/2010,18/12/2010,A comment to the dates 14/09/2010,18/09/2010,A ...