javascript

How to reload the page on back button click in any browser

Hi All, I have created the HTML page for example page1.html with some setting onclick invoke page2.html On Click Back button the page1 is getting loaded will all previous data. I want complete reload of page and donot want to remeber any setting. Regards, Dev ...

Pagination Alternatives

I am looking for ideas for pagination alternatives. I am aware of 2 pagination schemes: Click on pages pagination - my favorite example Infinite scroll pagination - one implementation here that seems to work There must be some other less known/popular ways to do it. Bonus points if you can provide a link to a demo Thanks ...

How to call jQuery function from normal JS function?

How to call jQuery function from normal JS function? ( A + B Sample needed) So I need a jQuery function adding varA to varB. And a JS function which could call that jQuery function sending varA and varB to It and reciving result. ...

Reusable architectural code management

Our code is in Java and Javascript (AJAX libraries). We have wrappers/reusable code around the existing libraries to perform mundane tasks like, db connections, session management, logging, hibernate settings, base structure, some reusable multitenancy code etc.. From the javascript end, we have page initializers, UI layout components, c...

How does this cross-domain request work ?

$.ajax( { url : "http://search.twitter.com/search.json?q=google&lang=en&rpp=10&since_id=&callback=?", dataType : 'json', success : function(data) { alert(data.results.length); } }); How exactly is this working ? I mean the cross-domain request. ...

Storing user events in backend

Hi - my javascript is horrible so I'm not sure if this is as straight forward as I'd hoped. I'd like to track user clicks through mouse events on my website. I have some simple java script that does that. How do I go about making it so my backend can store this? Is it even possible. Backend for now can be in anything what so ever :) ...

javascript switch(true)

Hi i am trying to handle an ajax json response here is my code success: function (j) { switch(true) { case (j.choice1): alert("choice2"); break; case (j.choice2): alert("choice2"); break; default: alert("default"); break; } } bas...

What's the best way to pass a PHP variable to Javascript?

I currently echo certain variables in hidden input fields and read them out with Javascript whenever I need them. Me and a colleague are now thinking of generating an extra Javascript file with PHP which only contains all variables for Javascript. This way the variables already exist and there is no extra code in the HTML. What are goo...

What is happening in Crockford's object creation technique?

There are only 3 lines of code, and yet I'm having trouble fully grasping this: Object.create = function (o) { function F() {} F.prototype = o; return new F(); }; newObject = Object.create(oldObject); (from Prototypal Inheritance) 1) Object.create() starts out by creating an empty function called F. I'm thinking that a fu...

How to get object values and properties in jquery ?

I am using jQuery selector to get the values of all CMS components on the page using $('div.cmscomponent') but how can I test this to see if am actually getting the list of compoents on the page. I use: var temp = $('div.cmscomponent'); alert(temp); and result that I get is [object OBJECT] and so how can I test this ? and how can I ...

How to use JQuery to truncate the contents of option tags?

Hello! Please take a look here: http://www.binarymark.com/Products/FLVDownloader/order.aspx What I am trying to do is to get rid of the prices inside the option tag. On that page you can see a drop-down box under Order Information, Product. I want to remove the prices from all the options that contain them in that box, so get rid of " ...

Javascript baloon-looking dialog

I have an html table. When user clicks on some cell - i am displaying a javascript dialog(currently JQuery), where user enters some information related to this cell. So i am looking for framework, which would visually connect the dialog to the cell being edited. Pretty much like baloon tooltip. Anybody saw this? probably JQuery plugi...

Call Public variable of C# in javascript ?

My Problem is I am try to call Public variable in Code Behind From JavaScript function I try To Do This : In Code Behind Section: public string str ="TEST"; In JavaScript Section: <script type="text/javascript" language="javascript"> function funDoSomething() { var strMessage = '<%= str%>'; alert( strMess...

jQuery show submit button on input field click

Hi, I'm trying to have a comment input field that will show the submit button on a dynamically created form when you click on the input field. Similar to how facebook comments work. When you click on the input field the submit button appears and when you click off it disappears. All the comment input id's are comment_1 etc and the subm...

javascript: use getElementsByName for 'this'?

I need to get some children elements and loop over them using inline javascript for a onmouseover event. When I try to use this.getElementsByName I'm getting an error that the object does not support this property. I was under the impression that getElementsByName work for element objects which I thought 'this' would be considered. Any...

Does Safari associate a browser window name with the domain that opened it?

I have a multiple-domain network of sites. In one domain, some javascript opens a new smaller window and gives it a name of "controls". If you go to a second domain and click to open "controls" again (same window name), it opens a new window rather than updating the one that already exists. Is it possible that Safari associates the ...

Google Maps : How to open an InfoWindow by hovering a link?

Hi there, i have a very simple question about Google Maps API. In this case, i have on my page a map on the left, with about 40 points, and the list of these 40 points on the right. So you know, when you click on a point of the map, the "info window" is displayed so you can see some informations about it. I can't find how can i do to s...

JScript JSON Object Check

I'm trying to check if json[0]['DATA']['name'][0]['DATA']['first_0'] exists or not when in some instances json[0]['DATA']['name'] contains nothing. I can check json[0]['DATA']['name'] using if (json[0]['DATA']['name'] == '') { // DOES NOT EXIST } however if (json[0]['DATA']['name'][0]['DATA']['first_0'] == '' || json[0]['DATA'][...

Can I increase the scope of 'this' in the following example?

In using a jquery callback, I found that 'this' isn't defined anymore. I've found a work around, which is to set 'this' to another variable. For example, like so: function handler(DATA) { var myThis = this; $.post( 'file.php', DATA, function() { // THIS where I need access to ...

Prototype JS: Can't get Element.update to work on element with a class

I am trying to add the ajax response text, to a div that has a class on it, and not an id. I try the following: var notice = $$('.testdiv'); Element.update(notice, transport.responseText) This doesn't work but if I change it to update an element that has an ID on it, it works. var notice = $('testdiv'); Element.update(notice, transpo...