javascript

Javascript - How do you call a function inside a class from within that class?

I am trying to call the function MyMethod from within a object but none of the syntax below works. There must be a really obvious error below but I can't see it. <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <script type="text/jscript"> function MyObject() { //how do I get one of these to work?? this.MyM...

The best way to accomplish Ajax Feeds

Hey guys. I'm currently starting a new project that will display user distrubuted data links in an ajax feed on front end. What I'm looking to accomplish is very similar to the to the Facebook Feeds on there index, where the content is updated every X Seconds. I already have half of the PHP side completed such as the Entities Compiler...

Hiding a TR with ajax/js

I have the following HTML: <tr id="n16"> <td class="t_row">Text <a href="#" onClick="javascript:notification_dismiss('16');">Dismiss</a></td> </tr> I want to update my database and hide the TR when people click Dismiss. Updating the database is working fine, but the TR won't hide. I have this JS: function stateChanged(str) ...

saving the last reading position

I need to get and save the reading position of the posts in wordpress website for the user to continue reading from the same position, when he/she signs in again, I tried with scrolltop in jquery but it is not cross browser compatible and gives different values in internet explorer, chrome and firefox, Is there any other way out ...

how to integrate google calendar in my app

how to integrate #google #calendar in my app with full function ;mutli level management CRUD ect ;any suggestions ??? my app built in codeigniter (php framework) there is other solutions easy to integrate in my application thanks in advance ...

How do I grab the last value in a string

I know I can parse out the int by doing parseInt($('#count_of_stations').html()) if the value is like this "2stations" that will return 2 but now I need to get the integers out in this format one1 two2 three3 four4 five5 How do i get just the number out ...

How to know which jQuery button was clicked in list context

I have a list of stories on a page and each has several jQuery buttons for different actions. When the button is clicked, I need to know what story it is was clicked for. Currently I have each story wrapped in a div with an id of format story_<story_id> and then in the handler I traverse up and parse out the id. <div id="story_1" cl...

Selecting an option by its text

Hi, I'm developing a web page using django and I want to add some javascript to a form using jQuery. Basically I want to select an option in a form depending on an another selection. I need to use option's text and not option's values because option's values are generated dynamically by django. An extract of my code: javascript $...

Add a new class into the css style with javascript

Hi, how can i insert a new class into the current css? var myStyle = $("head > style:eq(2)"); if( document.styleSheets[2].cssRules ) { myStyle.insertRule('#test { display:block; }', 0); } else { if ( document.styleSheets[2].rules ) { myStyle.addRule('#test', 'display:block;'); } } dd ...

Background image reflection

So I have a background image(background:url(my_image.jpg) no-repeat;), and I need a reflection for that picture, you can see here, what I mean: http://www.imgmodels.com/. Is there a way to do that, using a JS script or css hacks...? Best Regards, ...

JavaScript URL encode

Hi, I am encoding a string that will be passed in a url (get). But, if I use escape, encodeURI or encodeURIcomponent, & will be replaced with %26amp%3B and I want it to be replaced with just %26... What am I doing wrong? Dodo ...

Getting all visible elements using MooTools

Hi, I am moving from jQuery to MooTools (for the fun..) and I have this line of code : $subMenus = $headMenu.find('li ul.sub_menu:visible'); How I can write this in mootools? I know that I can use getElements but How I can check for visible ul?(I am using this(:visible) selector a lot). Edit - I implemented my own function : f...

ASP MVC 2 Dynamic Href By Javascript

Here is the deal: My link: <li><% =Html.ActionLink("Scheme", null, null, null, new { @id = "schemeid" })%></li> JavaScript for changing href: <script> document.getElementById('schemeid').href= "Test/ALL"; </script> Its working in any browser on ASP.NET dev.server on vs2010; but when i host it on iis 7. it fails. and in source ...

Post data to external js script and alert them

Hello... I am using this code to load and pass data to js file jQuery.ajax({ async: true, type: "GET", url: "js/test.js", data:({data : result}), success: function() {}, dataType: 'script' }); and in the the test.js i have this alert(result); but alert is not working and it does not throw any error... tes...

ASP MVC 2 Javascript

I have code on javascript: <script>var index=0</script> How can i pass it to htmlhelper forexample i want something like: <%Html.ActionLink("test",'+index+',"Stations")%>'; but its obvious doesn't work; ...

Creating a leaderboard using Facebook APIs and the PHP SDK

Hi All, I'm a new Facebook developer. I'm creating a game and want to include a leader board. I'd like to build a fairly detailed leader board including the following information: 1) Name 2) Pic_Square or profile_pic 3) A general location (UK, USA or LONDON, NY) 4) Score I'm aware of how to get a current users basic information from ...

In IE7 and IE6, setting element.style['display'] = 'inherit' thows an exception

What's a good workaround to this IE bug that would still allow me to set the display style of an HTML element to 'inherit' in IE7 or IE6 using javascript? var el = document.getElementById('someElementID'); if (!el) return false; try { var displayValue = 'inherit'; //the next line throws exception in IE7 and I...

Force jQuery to not register $

Hello, I know there exists a command like jQuery.noConflict. But for this it first registers $, then un-registers it afaik. I want to edit the jQuery 1.3.2 code to stop it from registering the $ in the first place. I know its not the best of ideas, but I need this in a particular project. Am just not sure how it can be done? I mean wha...

google map dragging like in maps.google.com

Hi all, I just want to add the effect of map momentum by the dragging of map as in maps.google.com has. currently on my map where i stop dragging the map stops there but in maps.google.com if you drag a mouse the map will not stop there it will continue the movement in the same direction for a second or few cordinates (i dont know basic...

colorbox (which uses live) not rebinding after jQuery ajax call

I have a list of elements that I am loading via ajax (using jQuery's .load()). Each of these elements has an (edit) link next to it that lightboxes (using colorbox) a little edit form. When the lightbox is closed I use the onClosed callback to reload the ajax list to show and changes made during the edit. The colorbox call looks likes t...