javascript

Dynamically generated javascript not executing in Chrome or IE, works in Firefox

I'm using the google maps API with GWT to create a tabbed infowindow with tweets inside one of the markers. the source of the tweets is dynamically generated. heres the java code: HTML recentTweets = new HTML( "<div>"+ "<script type='text/javascript' src='http://twitter.com/javascripts/blogger.js'&g...

How to convert a full date to a short date in javascript?

Hi I have a date like this Monday, January 9, 2010 I now want to convert it to 1/9/2010 mm/dd/yyyy I tried to do this var startDate = "Monday, January 9, 2010"; var convertedStartDate = new Date(startDate); var month = convertedStartDate.getMonth() + 1 var day = convertedStartDate.getDay(); var year = converted...

Questions about javascript dates

Hi I have 2 questions about dates. The first one is how can I get the "AM/PM" from a date in Javascript? the second question is say I have this code var convertedStartDate = new Date(dueDate); var month = convertedStartDate.getMonth() + 1; var day = convertedStartDate.getDate(); var year = convertedStartDate.getFullYe...

border color won't change

Hello, I'm trying to animate background-color,color and border color to change with jquery but for some reason border color is not changing any idea why? here is the portion of jquery code : $('#tabbed a').hover(function() { $(this).animate({ backgroundColor: "#FBFBFB", color:"#FD7A24", borderCo...

Send ByteArray to JavaScript

How to send a jpg image as ByteArray from as3 to javescript? And how to convert ByteArray to image in javascript? ...

Prototype issue - How do I check for links on an input field and check for the length of that input field?

I sort of started coding for this. It's almost working. My goals: 1) Check for the length or url's entered in a field (the total length) and reduce each link's length by 20 if the length is greater than 20 2) Determine the characters left in an input field The javascript in profile.js (prototype): function checkurl_total_length(text) {...

How to get the number of lines in a textarea?

What I would like is to count the number of lines in a textarea, e.g: line 1 line 2 line 3 line 4 should count up to 4 lines. Basically pressing enter once would transfer you to the next line The following code isn't working: var text = $("#myTextArea").val(); var lines = text.split("\r"); var count = lines.length; console.log(co...

Wordpress dynamic reply to comment not working

Any idea why? Of course comment_reply.js included correct way, Firebug not shooting any errors, but dynamic reply not working, redirecting me to the new page :( Damn! Edit: $defaults = array('walker' => null , 'style' => 'ul' , 'callback' => null , 'end-callback' => null ...

jQuery content slider

I am just delving into using jQuery and I want to start off by using good coding logic. I am developing an upload site where users can select "upload from computer" or "upload from url". I have two links above the content where users can choose to upload from their computer or from a url, and I want the content to change with jQuery (wit...

making a rotating or swing effect with scriptaculous shake?

I am trying to have an effect when moused over, the item does not shake from side to side, but slides sort of like a clock pendulum rotating from 180-90 degreeds (or whatever, I can't remember the exact numbers right now). Is this possible with scriptaculous or another js library? ...

JS+Regexp: Match anything except if it's between [[ ]]

I've got a <textarea> that will be basically a list of names, so I set a function to replace the spaces between the names for a new line. Now I need to specify that two or more spaces between names are in fact part of the same element. IE: John Lucas [[Laurie Vega]] [[Daniel Deer]] Robert Should turn to John Lucas [[Laurie Vega]] [[...

Using .bind (mootools) with onClick event

I have the code (inside one object) onclick: this._addX.bind(this) and then inside another object onclick: this._addY.bind(this) Now, _addX() and _addY are nearly identical, except they both end up calling (on the click event) a function with different argument values, say _addX calls foo('x') and _addY calls foo('y'). So I tried: ...

Google Maps and Markermanager throws error

I'm using google map API along with the MarkerManager. I load the 2 javascript libraries by JQuery. Here is my Javascript: function initialize() { $.getScript('http://gmaps-utility-library.googlecode.com/svn/trunk/markermanager/release/src/markermanager.js'); $.getScript('http://maps.google.com/maps?file=api&amp;amp;v=2&amp;asy...

Need help in OnChange event Javascript

Hi there, I have five text fields which are mark1, mark2, mark3, mark4 and total. I have a problem to make the total automatically display in the text field. I have no problem with the calculation part. But I can't make the total to be display automatically in the text field. How can I make the total to be automatically display in the t...

Validate image type using javascript

hi, i have a form like this: <form method=post src=upload enctype="multipart/form-data"> <input name="img1" id="img1" type="file"> <input type="submit" value="Upload"> </form > Please how can I valid this form using javascript so that only jpg files are uploaded. thanks for reading. ...

how can refresh a page remotly in javascript

Hi, is there a way to refresh a page remotly from another page in javascript. i want to force the browser to do a refresh when i go back to a page which was displayed before. im doing some code in a page and it should show some results in another page, when i go to the page where i suppose to see the results, i have to press F5 to see th...

How to trigger Uploadify onError even handler?

I am using Uploadify to upload files. Problem is, I need to inform users of any error during processing of those files. Uploadify has onError, onComplete, and onAllComplete even handler but I do not know how to trigger these events so that users are informed of what is going on. Do I need to send JSON string? There is a clue here and h...

Use current elements class as an array name?

Is it possible to use a string from an elements CSS class as an array name? I'm looking for a smarter way of storing default animations that may grow over time to include more options in the array. Example JavaScript (jQuery): - var a1 = ['red', 'pink']; var a2 = ['green', 'lime']; var a3 = ['blue', 'cyan']; $('ul li').click...

Drag and drop a link on the desktop to create a shortcut

My client asked me a interesting thing today. Drag and drop a link in the browser on the desktop to create a shortcut to the linked webpage. We have a web-application and it could be very good to enable the user to directly connect their application. Do you have any idea of how to do that ? ...

Google Maps:Knowing what marker the event was fired for

I have JSON objects returning form the server and markers created for them. On the mouseover event for these marker, I need to know the ID or what index of the JSON object the clicked marker was binded from. For eg. an array JS = {"a", "b", "c"} (cordinates ommited) was looped through and the markers were placed on the map. If the mark...