javascript

jQuery - sharing vars between functions

This should be fairly simple; i'm pretty sure I've just not understood it. FYI, the website is using jQuery to run ajax .load() on content. On my main parent page, in the header I have my nav .load() jQuery code:- <script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $('a.nav').click(function() { ...

How do i convert a json object to a string?

How do i convert a json object to a json string? var o = { name: "a", id:5}; var sz = //??? alert('The json will look like ' + sz); -edit- i forgot i would like to do it in jQuery or naively if possible ...

JavaScript: How to efficiently replace all values of an object without replacing the object

I have a number of objects collected in an array. The same objects are also attached to certain DOM elements for various reasons. From time to time I need to update one of these objects. The easiest way to do this is to find the object in the array with the same id property as the one I got new values for through AJAX and then replace it...

Forced selection in hidden / Backend using Javascript OR JQuery

Hello, I have regular form like this. <form action="/domainchecker.php" method="post"> <input type="text" name="domain" size="20"> <fieldset> <select name="ext"> <option>.com</option> <option>.net</option> <option>.org</option> <option>.us</option> <option>.info</option> <option>.biz</option...

BeautifulSoup get innerhtml data

I am trying to read data from a website. I can see the value I need but the value does not appear in the downloaded html code (using urllib2). The value is created by some js file and embedded into the webpage as innerhtml for that id. PS: How can that be extracted? raw source code cannot render js unlike the browsers! ...

Getting text input value when populated by another Javascript function

Hello I have a set of input text boxes that activate a calendar for selecting dates when clicked. This works fine. I now need to get the values entered into these inputs using the onblur event. My problem is that my Javascript isn't detecting the dates entered, but the default value of the input (i.e. garbage). Somehow I need to detec...

How to track exact event handler of HTML element, if it is not registered with the element?

I am using some third party control in my aspx form. The control renders into the following HTML code: <input type="text" style="height: 20px; text-align: right;" class="edit" id="numberBox" /> Now at the time i presses any key in this input text field, event fires but those events are not registered here with element perhaps the even...

flowchart and javascript

hello I am looking for a javascript library for drawing flowchart and Organization Charts in my Web project, someone know a good a library? thanks ...

Best way to pass Url to another page

I have pass url to another page via javascript .For example www.example.com/share.php?url=http://google.com/ (I create whole url via javascript , I add my url variable to static string (which is www.example.com/share.php?url= ) and I redirect user to this page). But while I am passing url variable to share script , special characters(ğü...

How to set status with HTML5 Web Database api

I'm using the HTML5 Web Database API and I have a function that checks to see if the app needs to go and perform it's setup phase : this.setupRequired = function() { var status; try { this.db.transaction(function(tx) { tx.executeSql("SELECT * FROM settings", [], function (tx,result) { if (resu...

django-cms: PlaceholderAdmin breaks admin form (wymeditor doesn't work)

I'm using django-cms 2.1 and have a problem with rendering a form for a model that contains PlaceholderField: The article model is nothing unusual except it has: sidebar = PlaceholderField('sidebar', related_name="news_sidebar") Then I set wymeditor widget for html fields: class NewsArticleAdminModelForm(forms.ModelForm): body =...

How to determine Ajax (XHR) request sender?

Hi all, Is there a way in any browser to find out who (which piece of code) actually sent an Ajax request? What I mean: in firebug one can monitor network activity (in the Net tab) but there is no way of guessing where the request was initiated from. Does anybody know firefox/firebug extensions or maybe other browser's extensions to sh...

Validation of radio button in cakephp

I want to validate radio button, when i checked radio button textbox will be disabled, but it cant happens. what will be the exact js for validate radio button. My JS code is : function selection_project_phd() { var phds = document.getElementById('EmployeeGuidedProjectPhd').value; var projs = document.getElementById('Em...

how to make a select bigger on the clientside

Hallo, I'm working on a website which is pretty simple and old. We just use standard ASP there is no JavaScript framework or something and I can't really program JavaScript. I have a cell in a table and in there I want to have between 1 and 7 select's. If there are seven I don't have enough space and because our company uses Internet E...

Writing asp.net code to run on client side

Hi! Is there a way (except for using JS on the html view) to tell asp.net to run a certain code on client side (instead of server side)? ...

why can't i set window.onload in IE8?

i have the following function, which works fine in firefox, but will do nothing in IE8 function print(url) { var w = window.open(url); w.onload = function() { w.print(); }; } i want to open a webpage and immediately open the print dialogue. ...

Obscure JavaScript code in index.php/index.html files

Hi, maybe someone here can help or explain what happened. Just noticed today that on one of my client sites all index.php / index.html got replaced and some obscure javascript code was added. The code is below: <script type="text/javascript"> var nhZE2uSD="Ow8xN18Ow8xN31"; var usW1446O0="Ow8xN3cOw8xN73Ow8xN63Ow8xN72"; var usW1446O1="Ow...

Javascript/HTML How do I change something that's in JOT format to GIF format.

Hi, I have an application that generates signatures. It is in JOT format: http://aspn.activestate.com/ASPN/CodeDoc/JOT/JOT/GD.html How do I write a JavaScript function to convert it into GIF format. I have been given this C example, but I don't know how to convert it. Thanks. void doJot2Gif(PODSObject *podsObj,const char* pBase64Da...

GZip with Mobile Browsers

I'm targetting a couple of web projects at mobile users, and noticed that some of the standard tools (JS libraries, json transfers, xml etc) are quite heavy for mobile data plans. I'd like to be able to implement gzip'd resources, and probably mod_deflate/mod_gzip to try and reduce the amount of bandwidth used by these devices. However...

RegExp alphanumeric String + Special Letters

First question : I want to replace all characters other than alphanumeric and Special Letters. For example , somestringğüş iöç123456!@#$%^&*()_+ to somestringğüş iöç123456 Second: For example , some---example--long-string to some-example-long-string I do not really know regexp , so I need 2 simple regexp strings.Thank you ...