javascript

JQuery Copy text & paste into textarea

I've created a javascript function that will take a hidden span, copy the text within that span and insert it into a single textarea tag on a website. I've written a function in JavaScript that does this (well, kinda, only after a few clicks), but I know there's a better way - any thoughts? The behavior is similar to a Retweet for twitte...

Attempt to add values to Array causes app to spin into an endless loop

for some sick reason, my check productIDs[addIndex] = allProductIDs[lastProductFoundIndex + i]; causes my app to spin into an infinite loop: numberOfImagesToDisplay is set to 4 if (state == "next") { for(var a = 0; a < numberOfImagesToDisplay; a++) { alert("a=" + a + ", numImages=" + numberOfImagesToDisplay) if (a ...

JQGrid subgrid Url: Is it possible to change the value of ?Id=id

Hi folks, I'm trying to implement a JqGrid with a subgrid as so... jQuery(document).ready(function() { jQuery("#list").jqGrid({ url: '/OrganizationalUnit/FindAll/', datatype: 'json', mtype: 'GET', colNames: ['Name', 'Actions'], ...

How can I convert this javascript function to PHP?

function escCtrlChars(str) { return str.replace(/[\0\t\n\v\f\r\xa0'"!-]/g, function(c) { return '!' + c.charCodeAt(0) + '!'; }); } Ok this is a function that replaces control characters from a string with another string starting and ending with ! My question is. Is c the character found while...

FireFox 3.5 Fetches Image Sprite Repetitively - how to prevent?

EDIT: Mozilla fixed the bug. This thread is dead. EDIT: This is a Mozilla bug. See this thread: https://bugzilla.mozilla.org/show%5Fbug.cgi?id=501853 I have a sprite I use for my images here: http://www.trailbehind.com/site%5Fmedia/images/sprite.png In FireFox 3.5, the sprite seems to get fetched every time I render an icon on my map,...

Is it possible to write a second non-static, selecting, priviledged function in a JQuery Plugin?

Almost all of the examples in the jQuery tutorials that I've read, usually use one major public function for their selecting plugin. When I say 'selecting' plugin, I mean one that is not simply a static function extended onto jQuery. For example: (function($) { jQuery.fn.actionList = function(options) { var opts = $.extend({}, $....

passing form parameters through html

Hello, My code is : //cron.html <head> <meta http-equiv=Content-Type content="text/html; charset=windows-1252"> <meta name=ProgId content=Word.Document> <meta name=Generator content="Microsoft Word 11"> <meta name=Originator content="Microsoft Word 11"> < </head> <body> <form method="post" action="CETrafficGenerator.php?step=2"> <...

How can I dynamically change the style of some text depending on user input?

Hi, First, let me start off by saying that I know absolutely nothing about JavaScript or client-side scripting. All of the programming I've ever done has been server-side, mostly PHP, with some Java thrown in too for good measure. So, I have absolutely no clue where to start with this problem. I have an application with very strict p...

Equality testing in Javascript

just trying to test for equality in this piece of code, but getting a fail. <input type="text" name="dave_blah"/> <input type="text" name="dave_bleh"/> I then access the name values of each of these inputs and assign them to two variables, name1 and name2. I then extract the first part of the name,delimited by a "_". var oldName = n...

Load raw image data using AJAX

I'm trying to do a bit of facebook integration with a website, and there's a particular call on the facebook api that post's a picture onto a users account. One of the parameters is the raw image data. The image is stored locally on the web server and I have a url to it. I was intending to load the image on the client using javascript un...

how to print part of rendered html page in javascript?

javascript code window.print() can print the current html page. My question is: if I have a div in an html page(for example, a page rendered from ASP.NET MVC view), then I want to print the div only. Is there any JQuery Unobtrusive javascrpt or normal javascript to implement this request? Make it more clear. Suppose the rendered html...

[jQuery] Execute script based on which option is selected in a select box?

I've got a select box where the user selects which elements they want to see based on option 1, option 2 and option 3. So what I'm trying to set up is have if option 1 is selected run one set of commands and if option 2 run another and so on. I guess I just need to know how to set up the jQuery selector. ...

javascript and element location

Hi, I want to get up to speed on element location and javascript. ie. if someone clicks on an element, I can show a menu just below that element. Now I realize I have to account for the fact that if someone clicks on a element to the extreme left/right or bottom of the page, I have to know if the menu is visible on the screen properly...

Can't work history.forward();

I want to prohibit the Back function of the browser. Therefore I write the following codes in html. <body> <script type="text/javascript"> <!-- history.forward() //--> </script> </body> but'The above "history.forward()" did not work suddenly when I coding html and some javascripts. What's wrong? In addition, please teach the d...

iframe position from itself

Hello, how can I get iframe position using JS in the current iframe? This code works in IE var browser = navigator.appName; if (browser == "Microsoft Internet Explorer") { scrollX=self.screenLeft; //works scrollY=self.screenTop; //works strange } How to do it in Firefox? screenLeft, screenTop - undefined screenX, screenY - the...

detecting change in a text input box using jquery/javascript

in html and javascript, I can use keyup, focus, blur to detect most of the content changes in a text input, however if the user do a copy and paste into the text input, how do I capture this change? The issue here is that the input is already in focus when user paste into it. ...

Regex to change spaces in images into entities

I'm having a lot of difficulty matching an image url with spaces. I need to make this http://site.com/site.com/files/images/img 2 (5).jpg into a div like this: .replace(/(http:\/\/([^\s]+\.(jpg|png|gif)))/ig, "<div style=\"background: url($1)\"></div>") Here's the thread about that: http://stackoverflow.com/questions/1066697/rege...

Error occurs when jQuery processing a form is inside another form

I am writing a form using jQuery and encounter some difficulties. My form works fine in static page (html). However, when I use the form in dynamic page(aspx), the form does not behave correctly. I cannot append items to the form and call the form.serialize function. I think the error occurs when a form is inside another form (.aspx co...

How should I use transparent pngs in IE 6 over a background-repeat?

The code below has a repeating background image "thinline.png". On top of that are 4 layered transparent PNGs: cardshadow.png, steel.png, startjobapplicationshadow.png and startapplication.png My goal is to make this code look good in IE6 without messing up other browsers. This feature of IE is widely documented but I have not been able...

Can I add a public function to objects in JavaScript? How?

I'm sure I've worded this question wrong, but I don't know how to explain it well... I have a vague idea I've read somewhere that I can add methods to objects in JavaScript - by which I mean something like: function Exclaimify(aString) { return aString + "!"; } var greeting = "Hello"; alert(greeting.Exclaimify()) // this shows "H...