javascript

Storing arbitrary data in HTML

What is the best way to embed data in html elements for later use? As an example, let's say we have jQuery returning some JSON from the server, and we want to dump that datat out to the user as paragraphs. However, we want to be able to attach meta-data to these elements, so we can events for these later. The way I tend to handle this...

How to retrieve value from asp.net textbox from javascript?

Hi, I have an asp.net web form with a couple of asp.net textbox controls: <asp:TextBox ID="txtTextBox" runat="server" /> . I have a javascript file tools.js that are included in the page: <script src="tools.js" type="text/javascript"></script> How can I access the value from txtTextBox from javascript? Ive tried using document.g...

auto reload: how it works?

i need to change something in my site, if some fields changed in database, but without reloading the page! but i have no idea how i can do it. could you give me an idea? thanks example: for example, i have a forum, and i need to show a image, if new comment resieved! i can write all functions, but i don't understand when i must call ...

Initializing a value through a Session variable

I need to Initialize a value in a Javascript by using a c# literal that makes reference to a Session Variable. I am using the following code <script type="text/javascript" language="javascript" > var myIndex = <%= !((Session["myIndex"]).Equals(null)||(Session["myIndex"]).Equals("")) ? Session["backgroundIndex"] : "1" %>; However ...

HTML element scrollbar on the left

Hi, is there a way with css or js to show the scrollbar of an element on the left instead of on the right? i don't need a crossbrowser way i need it only on Firefox. ...

What does this jQuery code mean?

Can anyone explain the meaning of this code? if (data.result) { $('ul#intlist').append(data.content); } ...

VS2010 renders controls JS awkwardly

I have created a Website Project in VS2010. My Controls are not rendered correctly. The JS that is produced is not correctly formatted. Here is an example: protected void Page_PreRender(object sender, EventArgs e) { if (!IsPostBack) { objListBox.Attributes.Add("onchange", "Control_doPostBack('" + objL...

How to find input element id by value?

Hello all, How do I get the id of an input element based on its value? The values will always be unique and there are only 7 of them. I have tried this: $('#wrapper').find("input[value='"+value+"']").each(function(){ return this.id; }); But nothing is returned! Thanks all for any help ...

Created function not found

I'm trying to create a simple function, but at runtime firebug says the function does not exist. Here's the function code: <script type="text/javascript"> function load_qtip(apply_qtip_to) { $(apply_qtip_to).each(function(){ $(this).qtip( { content: { // Set the text to an image HTML string with the ...

Lost in translation - C# regex to JavaScript regex

I'm having some trouble translating my working C# regular expression into JavaScript's regular expression implementation. Here's the regular expression: ([a-z]+)((\d+)([a-z]+))?,? When used on "water2cups,flour4cups,salt2teaspoon" you should get: [ ["water", "2cups", "2", "cups"] ["flout", "4cups", "4", "cups"] ["salt", ...

How to get portion of the attribute value using jquery

I have attribute value as: <div id = "2fComponents-2fPromotion-2f" class = "promotion"> Now I want to get only portion of it, say Promotion and its value 2f, how can I get this using jquery ? Do we have built in function for it ? ...

Ajax process from point of initiating a request to user seeing result?

Hi I'm looking for a straight forward list(with any notable information to match the point) of the separate processes involved from initiating the request object to the user seeing the end result in AJAX? Thanks. ...

IE is doing strange things with JQuery

So ... The thing is, the code works in FireFox, no problems. But when I open the same page, it gives me the following error: "Undefined is null or not an object." But when I copy the code to a localhost page, it works fine. Also when I clear my cache in IE it works, but only once, if I refresh after that one load, it gives me the same ...

I would like to access certain-resolution files within a multiresolution .ico from javascript (or html, for that matter)

I have created a nice multiresolution favicon.ico containing 16x16, 32x32, & 48x48 resolution icons. These load up all pretty-like within browsers or when the site is saved to the desktop. However, the same image is also being used on the website (specifically, as an icon within a toolbar). Currently, the 16x16 icon is also saved as a p...

jqtransform form selector (onchange) problem !!!!

I'm styling a form with Jqtransform script. The form includes a selector which enlist some cities, when i click a one, it should update the selector below it with some locations within that city. here is the code of the selector <select name="city" id="city" class="wide" onchange="populateDestrict(this)"> It was working fine with de...

How to pass value to controller?

When I try to pass the url value to the controller action, action is not getting the required value. I'm sending the value like this: function value(url,id) { alert(url); document.getElementById('rating').innerHTML=id; var params = 'artist='+id; alert(params); // var newurl='http://localhost/songs_full/public/eslres...

Why isn't a JS file hosted on Amazon S3 getting cached by the browser?

I have a JS file hosted on Amazon S3 (http://s3.amazonaws.com/wingify/vis_opt.js). I want the file to be cached on users' browsers so that they don't have to download it with every page view. However, in spite of setting Cache Control header I don't think it is getting cached. Browser still contacts Amazon Server with every pageview. He...

mootools 1.11 .setHTML not working in IE

Hello, I am trying to make a form dynamic using mootools 1.11, for specific reasons I cannot upgrade atm. I'm trying to manipulate a select field to have dynamic options. This works in Firefox & Chrome but not IE8. Hope there's a fix for this. bits of the code: myOptions(hrs+1, 23, 'uur'); $('vertrektijd_uur').setHTML('<option value=...

Too many jquery plugins?

I'm developing a website, but I realized that, in addition to the link to my main javascript file, and the link to the jquery file, it's beginning to look like I'm going to have links to three or more plugins also. I'm just wondering if this is good practice? The site I'm building is a web app, so I need a lot of functionality, but I don...

How do I let a user paste an image on a webpage?

I want to give the user possibility to paste an image into a webform. I don't need to display the image, all I need is the image's location. I know it's possible because the guys at CKEditor(and other editors) are doing it. If you go here, http://ckeditor.com/demo and paste an image you copied and then right click on it and go to imag...