Search Results

Search found 9872 results on 395 pages for 'preg replace callback'.

Page 13/395 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Regex preg_match issue with commas

    - by Serge Sf
    This is my code to pre_match when an amount looks like this: $ 99.00 and it works if (preg_match_all('/[$]\s\d+(\.\d+)?/', $tout, $matches)) { $tot2 = $matches[0]; $tot2 = preg_replace("/\\\$/", '', $tot2);} I need to do the same thing for a amount that looks like this (with a comma): $ 99,00 Thank you for your help (changing dot for comma do not help, there is an "escape" thing I do not understand... Idealy I need to preg_match any number that looks like an amount with dot or commas and with or without dollar sign before or after (I know, it's a lot to ask :) since on the result form I want to scan there are phone and street numbers... UPDATE (For some reason I cannot comment on replies) : To test properly, I need to preg_replace the comma by a dot (since we are dealings with sums, I don't think calculations can be done on numbers with commas in it). So to clarify my question, I should say : I need to transform, let's say "$ 200,24" to "200.24". (could be amounts bettween 0.10 to 1000.99) : $tot2 = preg_replace("/\\\$/", '', $tot2);} (this code just deals with the $ (it works), I need adaptation to deal also with the change of (,) for (.))

    Read the article

  • How does MatchEvaluator works? ( C# regex replace)

    - by Marin Doric
    This is the input string 23x * y34x2. I want to insert " * " (star surrounded by whitespaces) after every number followed by letter, and after every letter followed by number. So my input string would look like this: 23 * x * y * 34 * x * 2. This is the regex that does the job: @"\d(?=[a-z])|a-z". This is the function that I wrote that inserts the " * ". Regex reg = new Regex(@"\d(?=[a-z])|[a-z](?=\d)"); MatchCollection matchC; matchC = reg.Matches(input); int ii = 1; foreach (Match element in matchC)//foreach match I will find the index of that match { input = input.Insert(element.Index + ii, " * ");//since I' am inserting " * " ( 3 characters ) ii += 3; //I must increment index by 3 } return input; //return modified input My question how to do same job using .net MatchEvaluator? I'am new to regex and don't understand good replacing with MatchEvaluator. This is the code that I tried to wrote: Regex reg = new Regex(@"\d(?=[a-z])|[a-z](?=\d)"); MatchEvaluator matchEval = new MatchEvaluator(ReplaceStar); input = reg.Replace(input, matchEval); return input; } public string ReplaceStar( Match match ) { //return What?? }

    Read the article

  • How to temporarily replace one primitive type with another when compiling to different targets in c#

    - by Keith
    How to easily/quickly replace float's for doubles (for example) for compiling to two different targets using these two particular choices of primitive types? Discussion: I have a large amount of c# code under development that I need to compile to alternatively use float, double or decimals depending on the use case of the target assembly. Using something like “class MYNumber : Double” so that it is only necessary to change one line of code does not work as Double is sealed, and obviously there is no #define in C#. Peppering the code with #if #else statements is also not an option, there is just too much supporting Math operators/related code using these particular primitive types. I am at a loss on how to do this apparently simple task, thanks! Edit: Just a quick comment in relation to boxing mentioned in Kyles reply: Unfortunately I need to avoid boxing, mainly since float's are being chosen when maximum speed is required, and decimals when maximum accuracy is the priority (and taking the 20x+ performance hit is acceptable). Boxing would probably rules out decimals as a valid choice and defeat the purpose somewhat. Edit2: For reference, those suggesting generics as a possible answer to this question note that there are many issues which count generics out (at least for our needs). For an overview and further references see Using generics for calculations

    Read the article

  • jQuery find value then replace SRC

    - by Charles Web Dev
    Hello all, Can anyone see anything that is wrong with this code it just isn't working... I am tring to: get the value of #product-variants-option-0 search #preload for the relevant image and then change div.image img src to that image jQuery(document).ready(function($) { $('#product-variants-option-0').change(function() { // What is the sku of the current variant selection. var select_value = $(this).find(':selected').val(); if (select_value == "Kelly Green") { var keyword = "kly"; }; var new_src = $('#preload img[src*=keyword]'); $('div.image img').attr('src', new_src); }); }); The selection: <select class="single-option-selector-0" id="product-variants-option-0"> <option value="Kelly Green">Kelly Green</option> <option value="Navy">Navy</option> <option value="Olive">Olive</option> <option value="Cocoa">Cocoa</option> </select> I'm trying to search an unordered list: <ul id="preload" style="display:none;"> <li><img src="0z-kelly-green-medium.jpg"/></li> <li><img src="0z-olive-medium.jpg"/></li> </ul> The image I'm trying to replace is this:

    Read the article

  • shell scripting: search/replace & check file exist

    - by johndashen
    I have a perl script (or any executable) E which will take a file foo.xml and write a file foo.txt. I use a Beowulf cluster to run E for a large number of XML files, but I'd like to write a simple job server script in shell (bash) which doesn't overwrite existing txt files. I'm currently doing something like #!/bin/sh PATTERN="[A-Z]*0[1-2][a-j]"; # this matches foo in all cases todo=`ls *.xml | grep $PATTERN -o`; isdone=`ls *.txt | grep $PATTERN -o`; whatsleft=todo - isdone; # what's the unix magic? #tack on the .xml prefix with sed or something #and then call the job server; jobserve E "$whatsleft"; and then I don't know how to get the difference between $todo and $isdone. I'd prefer using sort/uniq to something like a for loop with grep inside, but I'm not sure how to do it (pipes? temporary files?) As a bonus question, is there a way to do lookahead search in bash grep? To clarify: so the simplest way to do what i'm asking is (in pseudocode) for i in `/bin/ls *.xml` do replace xml suffix with txt if [that file exists] add to whatsleft list end done

    Read the article

  • keep HTMLformat after replace some text (using PHP and JS)

    - by Sadi
    I would like modify HTML like I am <b>Sadi, novice</b> programmer. to I am <b>Sadi, learner</b> programmer. To do it I will search using a string "novice programmer". How can I do it please? Any idea? Thank you Sadi More clarification: I get some nice reply with possible solution. But please keep posting if you have any idea in mind. I would like to more clarify the problem just in case anyone missed it. Main post shows the problem as an example scenario. 1) Now the problem is find and replace some string without considering the tags. The tags may shows up within a single word. String may contain multiple word. Tag only appear in the content string or the document. The search phrase never contain any tags. We can easily remove all tags and do some text operation. But here the another problem shows up. 2) The tags must be preserve, even after replacing the text. That is what the example shows. Thank you Again for helping

    Read the article

  • Multiple/repeat .replace on one page

    - by Kenneth B
    I've made a script which copies the ALT-tag of an image and puts it into a SPAN. It also formates the information devided by a hyphen. It works like a charm, but only with one image. Further more, I would like it to wrap a div around the image, to prevent unnecessary markup, as I have now. Any ideas is much appreciated... :-) Script that works now: HTML: <div id="hoejre"> <p><span class="alignright"><img src="tommy_stor.jpg" alt="Name - Title" width="162" height="219" /><span></span></span></p> </div> jQuery: var alt = $("#hoejre p span img").attr("alt"); $('#hoejre p span span').html("<strong>" + alt.replace("-", "</strong> <em>") + "</em>"); Output: <span class="alignright"><img height="219" width="162" alt="Name - Title" src="tommy_stor.jpg"><span><strong>Name </strong> <em> Title</em></span></span> How do you I repeat the effect on several images, with different information within? P.S.: I really love this forum. I have used several other forums for this kind of questions, but this one is by far the most professional.

    Read the article

  • Selectively search and replace certain lines using a regular expression

    - by eneveu
    I have a file containing a lot of SQL statements, such as: CREATE TABLE "USER" ( "ID" INTEGER PRIMARY KEY, "NAME" CHARACTER VARYING(50) NOT NULL, "AGE" INTEGER NOT NULL ); COPY "USER" (id, name, age) FROM stdin; 1 Skywalker 19 2 Kenobi 57 I want the column names in the COPY statements to be uppercased and quoted: COPY "USER" ("ID", "NAME", "AGE") FROM stdin; Using sed, I found the following regexp: sed -r 's/([( ])(\w+)([,)])/\1"\U\2\E"\3/g' It does replace the column names, but it is not selective enough, and replaces other words in the file: ~/test]$sed -r 's/([( ])(\w+)([,)])/\1"\U\2\E"\3/g' star_wars_example CREATE TABLE "USER" ( "ID" INTEGER PRIMARY "KEY", "NAME" CHARACTER VARYING("50")NOT "NULL", "AGE" INTEGER NOT NULL ); COPY "USER" ("ID", "NAME", "AGE") FROM stdin; 1 Skywalker 19 2 Kenobi 57 To avoid this problem, I want sed to only apply my regexp to the lines starting with COPY and ending with FROM stdin;. I have looked into lookahead / lookbehind, but they are not supported in sed. They seem to be supported in super-sed, but I am currently using Cygwin (Windows is mandatory here...) and it does not seem available in the package list. Is there a way to force sed to only consider specific line? I've considered piping my file through grep before applying sed, but other lines will then disappear from the output. Am I missing something obvious? It would be great if the answer was easily applicable on a default Cygwin install. I guess I could try installing super-sed on cygwin, but I'd like to know if there are more obvious ideas

    Read the article

  • Python finding substring between certain characters using regex and replace()

    - by jCuga
    Suppose I have a string with lots of random stuff in it like the following: strJunk ="asdf2adsf29Value=five&lakl23ljk43asdldl" And I'm interested in obtaining the substring sitting between 'Value=' and '&', which in this example would be 'five'. I can use a regex like the following: match = re.search(r'Value=?([^&>]+)', strJunk) >>> print match.group(0) Value=five >>> print match.group(1) five How come match.group(0) is the whole thing 'Value=five' and group(1) is just 'five'? And is there a way for me to just get 'five' as the only result? (This question stems from me only having a tenuous grasp of regex) I am also going to have to make a substitution in this string such such as the following: val1 = match.group(1) strJunk.replace(val1, "six", 1) Which yields: 'asdf2adsf29Value=six&lakl23ljk43asdldl' Considering that I plan on performing the above two tasks (finding the string between 'Value=' and '&', as well as replacing that value) over and over, I was wondering if there are any other more efficient ways of looking for the substring and replacing it in the original string. I'm fine sticking with what I've got but I just want to make sure that I'm not taking up more time than I have to be if better methods are out there.

    Read the article

  • How to replace same text in a text file

    - by user1688220
    i created a c# windows login form and i am saving username or password to a text file but every time i use same username or password that i have saved before it takes new place in that text file. But What i want is to replace the same username or password that is already saved in that text file. this is my code: private void button1_Click(object sender, EventArgs e) { try { FileStream fs = new FileStream("data.txt", FileMode.Append, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.Write("Email ID: "); sw.WriteLine(textBox1.Text); sw.Write("Password: "); sw.Write(textBox2.Text); sw.WriteLine(); sw.WriteLine(); sw.Flush(); sw.Close(); fs.Close(); } catch (Exception) { MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } MessageBox.Show("DONE", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Clear(); textBox2.Clear(); }

    Read the article

  • Remove accents from String .NET

    - by developerit
    Private Const ACCENT As String = “ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÌÍÎÏìíîïÙÚÛÜùúûüÿÑñÇç” Private Const SANSACCENT As String = “AAAAAAaaaaaaOOOOOOooooooEEEEeeeeIIIIiiiiUUUUuuuuyNnCc” Public Shared Function FormatForUrl(ByVal uriBase As String) As String If String.IsNullOrEmpty(uriBase) Then Return uriBase End If ‘// Declaration de variables Dim chaine As String = uriBase.Trim.Replace(” “, “-”) chaine = chaine.Replace(” “c, “-”c) chaine = chaine.Replace(“–”, “-”) chaine = chaine.Replace(“‘”c, String.Empty) chaine = chaine.Replace(“?”c, String.Empty) chaine = chaine.Replace(“#”c, String.Empty) chaine = chaine.Replace(“:”c, String.Empty) chaine = chaine.Replace(“;”c, String.Empty) ‘// Conversion des chaines en tableaux de caractŠres Dim tableauSansAccent As Char() = SANSACCENT.ToCharArray Dim tableauAccent As Char() = ACCENT.ToCharArray ‘// Pour chaque accent For i As Integer = 0 To ACCENT.Length – 1 ‘ // Remplacement de l’accent par son ‚quivalent sans accent dans la chaŒne de caractŠres chaine = chaine.Replace(tableauAccent(i).ToString(), tableauSansAccent(i).ToString()) Next ‘// Retour du resultat Return chaine End Function

    Read the article

  • Is it possible to wrap an asynchronous event and its callback in a function that returns a boolean?

    - by Rob Flaherty
    I'm trying to write a simple test that creates an image element, checks the image attributes, and then returns true/false. The problem is that using the onload event makes the test asynchronous. On it own this isn't a problem (using a callback as I've done in the code below is easy), but what I can't figure out is how to encapsulate this into a single function that returns a boolean. I've tried various combinations of closures, recursion, and self-executing functions but have had no luck. So my question: am I being dense and overlooking something simple, or is this in fact not possible, because, no matter what, I'm still trying to wrap an asynchronous function in synchronous expectations? Here's the code: var supportsImage = function(callback) { var img = new Image(); img.onload = function() { //Check attributes and pass true or false to callback callback(true); }; img.src = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='; }; supportsImage(function(status){ console.log(status); }); To be clear, what I want is to be able to wrap this in something such that it can be used like: if (supportsImage) { //Do some crazy stuff } Thanks! (Btw, I know there are a ton of SO questions regarding confusion about synchronous vs. asynchronous. Apologies if this can be reduced to something previously answered.)

    Read the article

  • Using SDL to replace colors using SDL Color Keys

    - by Shawn B
    Hey, I am working an a simple Roguelike game, and using SDL as the display. The Graphics for the game is an image of Codepage 437, with the background being black, and the font white. Instead of using many seperate image files that are already colored, I want to use one image file, and replace the colors when it is being loaded into memory. The code to split the codepage into a sprite sheet works properly, but when attempting to print in color, everything comes out in white. I had it working the past, but somehow I broke the code when changing it from change the color at print, to change the color on load. Here is the code to load the image: SDL_Surface *Screen,*Font[2]; SDL_Rect Character[256]; Uint8 ScreenY,ScreenX; Uint16 PrintX,PrintY,ScreenSizeY,ScreenSizeX; Uint32 Color[2]; void InitDisplay() { if(SDL_Init(SDL_INIT_VIDEO) == -1) { printf("SDL Init failed\n"); return; } ScreenSizeY = 600; ScreenSizeX = 800; Screen = SDL_SetVideoMode(ScreenSizeX,ScreenSizeY,32,SDL_HWSURFACE | SDL_RESIZABLE); SDL_WM_SetCaption("Alpha",NULL); SDL_Surface *Load; Load = IMG_Load("resource/font.png"); Font[0] = SDL_DisplayFormat(Load); SDL_FreeSurface(Load); Color[0] = SDL_MapRGB(Font[0]->format,255,255,255); Color[1] = SDL_MapRGB(Font[0]->format,255,0,0); Uint8 i,j,k = 0; PrintX = 0; PrintY = 0; for(i = 0; i < 16; i++) { for(j = 0; j < 16; j++) { Character[k].x = PrintX; Character[k].y = PrintY; Character[k].w = 8; Character[k].h = 12; k++; PrintX += 8; } PrintX = 0; PrintY += 12; } PrintX = 0; PrintY = 0; for(i = 1; i < 2; i++) { Font[i] = SDL_DisplayFormat(Font[0]); SDL_SetColorKey(Font[i],SDL_SRCCOLORKEY,Color[i]); SDL_FillRect(Font[i],&Font[i]->clip_rect,Color[i]); SDL_BlitSurface(Font[0],NULL,Font[i],NULL); SDL_SetColorKey(Font[0],0,Color[0]); } } The problem is with the last for loop above. I can't figure out why it isn't working. Any help is greatly appreciated!

    Read the article

  • JavaScript and callback nesting

    - by Jake King
    A lot of JavaScript libraries (notably jQuery) use chaining, which allows the reduction of this: var foo = $(".foo"); foo.stop(); foo.show(); foo.animate({ top: 0 }); to this: $(".foo").stop().show().animate({ top: 0 }); With proper formatting, I think this is quite a nice syntactic capability. However, I often see a pattern which I don't particularly like, but appears to be a necessary evil in non-blocking models. This is the ever-present nesting of callback functions: $(".foo").animate({ top: 0, }, { callback: function () { $.ajax({ url: 'ajax.php', }, { callback: function () { ... } }); } }); And it never ends. Even though I love the ease non-blocking models provide, I hate the odd nesting of function literals it forces upon the programmer. I'm interesting in writing a small JS library as an exercise, and I'd love to find a better way to do this, but I don't know how it could be done without feeling hacky. Are there any projects out there that have resolved this problem before? And if not, what are the alternatives to this ugly, meaningless code structure?

    Read the article

  • "Could not register destruction callback" warn message leads to memory leaks?

    - by Séb
    Hello all, I'm in the exact same situation as this old question: http://stackoverflow.com/questions/2077558/warn-could-not-register-destruction-callback In short: I see a warning saying that a destruction callback could not be registered for some beans. My question is: since the beans whose destruction callback cannot be registered are two persistance beans, could this be the source of a memory leak? I am experiencing a leak in my app. Although the session timeout is set (to 30 minutes), my profiler shows me more instances of the hibernate SessionImpl each time I run a thread dump. The number of instances of SessionImpl is exactly the number of times I tried to login between two thread dumps. Thanks for your help...

    Read the article

  • Implementing callback functions in C

    - by robertjohn123
    Hi, I am a newbie to C.I am trying to implement callback function using function pointers. I am getting an error :test_callback.c:10: error: expected identifier or ‘(’ before ‘void’ when I try to compile the following program: #include<stdio.h> void (*callback) (void); void callback_proc () { printf ("Inside callback funtion\n"); } void register ((void (*callback) (void))) { printf ("Inside registration \n"); callback (); /* Calling an initial callback with function pointer */ } int main () { callback = callback_proc;/* Assigning function to the function pointer */ register (callback);/* Passing the function pointer */ return 0; } What is this error?Can anyone help?

    Read the article

  • I have string with "\u00a0" and I need to replace it with "" str_replace fails

    - by 0plus1
    I need to clean a string that comes (copy/pasted) from various office suite (excel, access, word) each with his own set of encoding. I'm using json_encode for debugging purposes in order to being able to see every single encoded character. I'm able to clean everything I found so far (\r \n) with str_replace, but with \u00a0 I have no luck. $string = '[email protected]\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0;[email protected]'; //this is the output from json_encode $clean = str_replace("\u00a0", "",$string); returns: [email protected]\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0;[email protected] that is exactly the same, it completly ignores \u00a0. Is there a way around this also I'm feeling I'm reinventing the wheel, is there any function/class that completely strips EVERY possibile char of EVERY possible encoding? Thank you for your time. _EDIT_ After the first two replies I need to clarify that my example DOES work because it's the output from json_encode not the actual string! _EDIT_

    Read the article

  • Replace with wildcard, in SQL

    - by Jay
    I know MS T-SQL does not support regular expression, but I need similar functionality. Here's what I'm trying to do: I have a varchar table field which stores a breadcrumb, like this: /ID1:Category1/ID2:Category2/ID3:Category3/ Each Category name is preceded by its Category ID, separated by a colon. I'd like to select and display these breadcrumbs but I want to remove the Category IDs and colons, like this: /Category1/Category2/Category3/ Everything between the leading slash (/) up to and including the colon (:) should be stripped out. I don't have the option of extracting the data, manipulating it externally, and re-inserting back into the table; so I'm trying to accomplish this in a SELECT statement. I also can't resort to using a cursor to loop through each row and clean each field with a nested loop, due to the number of rows returned in the SELECT. Can this be done? Thanks all - Jay

    Read the article

  • Regex one-to-one mapping pattern replace

    - by polygenelubricants
    How would you use regex to write a function that replaces all lowercase letters with uppercase and vice versa? Note: this is NOT a homework question. See also my previous explorations of regex: Regex split into overlapping strings (Alan Moore's answer is especially instructive) Can you use zero-width matching regex in String split? (my solution exploits a known Java regex bug with regards to non-obvious length lookbehind!)

    Read the article

  • replace string in preg_replace

    - by zahir hussain
    <?php $a="php.net s earch for in the all php.net sites this mirror only function list online documentation bug database Site News Archive All Changelogs just pear.php.net just pecl.php.net just talks.php.net general mailing list developer mailing list documentation mailing list What is PHP? PHP is a widely-used..."; ?> I want to highlight specific words. For example php, net and func: php.net s earch for in the all **php**.**net** sites this mirror only **func**tion list online documentation bug database Site News Archive All Changelogs just pear.**php**.**net** just pecl.**php**.**net** just talks.php.net general mailing list developer mailing list documentation mailing list What is **PHP**? **PHP** is a widely-used... Thanks advance.

    Read the article

  • multiline perl search and replace (one-liner)

    - by yaya3
    I want to perform the following vim substitution as a one-liner in the terminal with perl. I would prefer to allow for any occurences of white space and/or new lines, rather than explicitly catering for them as I am below. %s/blockDontForget">\n*\s*<p><span><a\(.*\)<\/span>/blockDontForget"><p><a\1/g I've tried this: perl -pi -e 's/blockDontForget"><p><span><a(.*)<\/span>/blockDontForget"><p><a$1/msg' I presume I am misinterpreting the flags. Where am I going wrong? Thanks. EDIT: The above example is to strip the spans out of the following html: <div class="block blockDontForget"> <p><span><a href="../../../foo/bar/x/x.html">Lorem Ipsum</a></span></p> </div>

    Read the article

  • find and replace values in a flat-file using PHP

    - by peirix
    I'd think there was a question on this already, but I can't find one. Maybe the solution is too easy... Anyway, I have a flat-file and want to let the user change the values based on a name. I've already sorted out creating new name+value-pairs using the fopen('a') mode, using jQuery to send the AJAX call with newValue and newName. But say the content looks like this: host|http:www.stackoverflow.com folder|/questions/ folder2|/users/ And now I want to change the folder value. So I'll send in folder as oldName and /tags/ as newValue. What's the best way to overwrite the value? The order in the list doesn't matter, and the name will always be on the left, followed by a |(pipe), the value and then a new-line. My first thought was to read the list, store it in an array, search all the [0]'s for oldName, then change the [1] that belongs to it, and then write it back to a file. But I feel there is a better way around this? Any ideas? Maybe regex?

    Read the article

  • Replace underscore between words (reg.exp)

    - by lasseespeholt
    Hey, I need a regular expression to solve the following problem (links to similar problems is also appreciated, related tutorials etc.): __some_words_a_b___ => __some words a b___ ____ => ____ So I want underscores between words to be replaced with space and keep leading and trailing underscores. I found this: ^[ \t]+|[ \t]+$ and I guess it most be something like that. I will use it in jQuery, Java (stdlibs) and maybe XSLT. Addition: The sentences do not necessarily start with underscores or ends with underscores. It is also possible that a sentence ain't containing underscores at all. Best regards Lasse Espeholt

    Read the article

  • Replace whitespaces using PHP preg_replace function ignoring quoted strings

    - by Saiful
    Look at the following string: SELECT column1 , column2, column3 FROM table1 WHERE column1 = 'text, "FROM" \'from\\\' x' AND column2 = "sample text 'where' \"where\\\" " AND ( column3 = 5 ) I need to escape unnecessary white space characters from the string like: removing white space from beginning and ending position of , ( ) etc removing newline (\r\n) and tabs (\t) But one thing. The remove process could not remove white spaces from the quoted string like: 'text, "FROM" \'from\\' x' "sample text 'where' \"where\\" " etc. i need to use the PHP function: preg_replace($pattern, $replacement, $string); So what will be the value of $pattern and $replacement where the value of $string is the given SQL.

    Read the article

  • Find and replace certain part of value (jquery)

    - by Hakan
    This might be a little complicated. See code below. When image is clicked I want to change "MY-ID-NUMBER" in "value" and "src" of object. But I want the other information to remain. When link is clicked I want to restore "value" and "src" so I can use the same function for next image that is clicked. Is it possible? Please help! My HTML: <img height="186" width="134" alt="4988" src="i123.jpg"> <img height="186" width="134" alt="4567" src="i124.jpg"> <a class="restore-to-default" href="#">DVD</a> <div class="tdt"> <object width="960" height="540"><param name="movie" value="http://www.domain.com/v3.4/player.swf?file=http://se.player-feed.domain.com/cinema/MY-ID-NUMBER/123-1/><param name="wmode" value="transparent" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><embed id="player" name="player" type="application/x-shockwave-flash" src="http://www.player.domain.com/v3.4/player.swf?file=http://se.player-feed.domain.com/cinema/MY-ID-NUMBER/123-1/&display_title=over&menu=true&enable_link=true&default_quality=xxlarge&controlbar=over&autostart=true&backcolor=000000&frontcolor=ffffff&share=0&repeat=always&displayclick=play&volume=80&linktarget=_blank" width="960" height="540"allowFullScreen="true" allowScriptAccess="always"></embed></object> My jquery: $('img').click(function(){ var alt = $(this).attr("alt"); $('.tdt object').val("alt", alt); // Some how change "MY-ID-NUMBER" into the "alt-value" of image }); $('a').click(function(){ //restore to "MY-ID-NUMBER" }); Thanks!

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >