Search Results

Search found 6478 results on 260 pages for 'hippy head'.

Page 112/260 | < Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >

  • JQuery: How do I perform a callback on JQuery once it's loaded?

    - by Teddyk
    I'm downloading JQuery asynchronously: function addScript(url) { var script = document.createElement('script'); script.src = url; document.getElementsByTagName('head')[0].appendChild(script); } addScript('jquery.js'); // non-jquery code ... // jquery specific code like: $()... As such - how do I call my JQuery specific code once JQuery is loaded (because since I'm downloading my JavaScript asynch - it's not blocking, which is good, but is trying to execute my JQuery specific code before JQuery has been loaded).

    Read the article

  • Why won't my images align properly?

    I'm trying to make a dynamically sizable title banner, using fairly simple image tricks. I place the banner image in a table cell, and set the background-image of the table row to a one-pixel-wide repeat of the banner's right-most pixel column. Thus, the banner image appears to stretch to fit the screen width without stretching the logo. The code below is my entire page so far, and the problem is shown in a red circle in the screenshot. This is the transition where the main image ends and the one-pixel-wide background image begins. It appears that the one-pixel-wide bar at the end is compressed by one pixel - making the tops align properly, while the bottoms are one pixel off. I should add that I have checked the images more than once to make cure they the image data is correct. They are %100 accurate as far as MSPaint is concerned. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body bgcolor="#000000"> <form id="form1" runat="server"> <div> <table style="width:100%; "> <tr style="background-image: url('Images/Banners/WebBannerWideBar.png')"> <!--WebBannerWideBar is 1x100 px--> <td> <img alt="Angry Octopus" src="Images/Banners/WebBannerWide.png" /> <!--WebBannerWide is 760x100 px--> </td> </tr> </table> </div> </form> </body> </html>

    Read the article

  • Adding a web address to a <a href="value">

    - by Michael Robinson
    I have an upload script that write a index.html file, I modified it to mail me the results, however the point to the root, since the email isn't in the root, the image doesn't load. How do I append the code to add "http://www.home.html/uploaded" prior to the ". $value ." so that the images show up in the email. Here is portion of PHP that assigns the images to a $result: // Process value of Imagedata field, this is JPEG-files array foreach ($_FILES[Imagedata][name] as $key => $value) { $uploadfile = $destination_dir . basename($_FILES[Imagedata][name][$key]); if (move_uploaded_file($_FILES['Imagedata']['tmp_name'][$key], $uploadfile)) { $result .= "File uploaded: <a href='". $value . "'>" . $value . "</a><br>"; } } // $result .= "<br>"; Here is what I'm now receiving in the email, : <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Upload results</title> </head> <body> AdditionalStringVariable: pass additional data here<br><a> href='gallery_grannylovesthis_l.jpg'><img border = '0' src='QIU_thumb_gallery_grannylovesthis_l.jpg'/></a><br><br><br>File uploaded: <a href='gallery_grannylovesthis_l.jpg'>gallery_grannylovesthis_l.jpg</a><br><br> GlobalControlData: PHOTO_VISIBILITY : 2<br> GlobalControlData: PHOTO_DESCR : Requiredtest<br> GlobalControlData: PHOTO_TITLE : Requiredtest<br><br>gallery_grannylovesthis_l.png<br> control: , value: <br> </body> </html> Thanks in advance for any guidance...I have a feeling it's something simple.

    Read the article

  • Local Variables take 7x longer to access than global variables?

    - by ItzWarty
    I was trying to benchmark the gain/loss of "caching" math.floor, in hopes that I could make calls faster. Here was the test: <html> <head> <script> window.onload = function() { var startTime = new Date().getTime(); var k = 0; for(var i = 0; i < 1000000; i++) k += Math.floor(9.99); var mathFloorTime = new Date().getTime() - startTime; startTime = new Date().getTime(); window.mfloor = Math.floor; k = 0; for(var i = 0; i < 1000000; i++) k += window.mfloor(9.99); var globalFloorTime = new Date().getTime() - startTime; startTime = new Date().getTime(); var mfloor = Math.floor; k = 0; for(var i = 0; i < 1000000; i++) k += mfloor(9.99); var localFloorTime = new Date().getTime() - startTime; document.getElementById("MathResult").innerHTML = mathFloorTime; document.getElementById("globalResult").innerHTML = globalFloorTime; document.getElementById("localResult").innerHTML = localFloorTime; }; </script> </head> <body> Math.floor: <span id="MathResult"></span>ms <br /> var mathfloor: <span id="globalResult"></span>ms <br /> window.mathfloor: <span id="localResult"></span>ms <br /> </body> </html> My results from the test: [Chromium 5.0.308.0]: Math.floor: 49ms var mathfloor: 271ms window.mathfloor: 40ms [IE 8.0.6001.18702] Math.floor: 703ms var mathfloor: 9890ms [LOL!] window.mathfloor: 375ms [Firefox [Minefield] 3.7a4pre] Math.floor: 42ms var mathfloor: 2257ms window.mathfloor: 60ms [Safari 4.0.4[531.21.10] ] Math.floor: 92ms var mathfloor: 289ms window.mathfloor: 90ms [Opera 10.10 build 1893] Math.floor: 500ms var mathfloor: 843ms window.mathfloor: 360ms [Konqueror 4.3.90 [KDE 4.3.90 [KDE 4.4 RC1]]] Math.floor: 453ms var mathfloor: 563ms window.mathfloor: 312ms The variance is random, of course, but for the most part In all cases [this shows time taken]: [takes longer] mathfloor Math.floor window.mathfloor [is faster] Why is this? In my projects i've been using var mfloor = Math.floor, and according to my not-so-amazing benchmarks, my efforts to "optimize" actually slowed down the script by ALOT... Is there any other way to make my code more "efficient"...? I'm at the stage where i basically need to optimize, so no, this isn't "premature optimization"...

    Read the article

  • How do I run JavaScript in my ContentPlaceHolder?

    - by donde
    I had a load of javascript that ran well when everything was in one page. Now that I've separated it out, I'm not sure how to include the javascript, ssing the HEAD tag in in the master, and also, I had functions that ran when the body loaded but they are in the master too. By the way this is a .NET 2.0 app.

    Read the article

  • Regex Help with manipulating string

    - by user310070
    Hi, i am seriously struggling to get my head around regex. I have a sring with "iPhone: 52.973053,-0.021447" i want to extract the two numbers after the colon into two seperate strings so delimited by the comma. Can anyone help me? Cheers

    Read the article

  • C++: incorrect swapping of nodes in linked list

    - by Dragon
    I have 2 simple structures: struct Address { char city[255]; }; typedef Address* AddressPtr; struct Person { char fullName[255]; Address* address; Person* next; }; typedef Person* PersonPtr; The Person structure forms the Linked list where new elements are added to the beginning of the list. What I want to do is to sort them by fullName. At first I tried to swap links, but I lost the beginning of the list and as a result my list was sorted partially. Then I decided to sort list by swapping the values of nodes. But I get strange results. For a list with names: Test3, Test2, Test1, I get Test3, Test3, Test3. Here is my sorting code: void sortByName(PersonPtr& head) { TaskPtr currentNode, nextNode; for(currentNode = head; currentNode->next != NULL; currentNode = currentNode->next) { for(nextNode = currentNode->next; nextNode != NULL; nextNode = nextNode->next) { if(strcmp(currentNode->fullName, nextNode->fullName) > 0) { swapNodes(currentNode, nextNode); } } } } void swapNodes(PersonPtr& node1, PersonPtr& node2) { PersonPtr temp_node = node2; strcpy(node2->fullName, node1->fullName); strcpy(node1->fullName, temp_node->fullName); strcpy(node2->address->city, node1->address->city); strcpy(node1->address->city, temp_node->address->city); } After the sorting completion, nodes values are a little bit strange. UPDATED This is how I swapped links void swapNodes(PersonPtr& node1, PersonPtr& node2) { PersonPtr temp_person; AddressPtr temp_address; temp_person = node2; node2 = node1; node1 = temp_person; temp_address = node2->address; node2->address = node1->address; node1->address = temp_address; }

    Read the article

  • Ajax function not called when included

    - by Sev
    I have an ajax function that is not run when the ajax script is included in my HTML page like so: <script type='text/javascript' src='ajax.js'></script> However, if I place the exact same script in the head portion of the HTML page, then it does run. Why does this occur, and how can I fix it?

    Read the article

  • Can the google map API return a street address that was clicked.

    - by Code
    Hi guys, I'm trying to work out an app design in my head and I would like the user to be able to click there destination address on the map of there area. If I know the user is in Liverpool is it possible to pop up the map over liverpool and then allow the user to select on the map where they wanna go, and the google map/api return the street or the name of the area? I've never used googlemap/api yet so just wondering if this kind of thing is possible on the iphone yet. Many Thanks -Code

    Read the article

  • How do I create a class in Javascript?

    - by William
    This is what I got so far, and it's not working at all :( <!DOCTYPE html> <html lang="en"> <head> <title>Class Test</title> <meta charset="utf-8" /> <style> body { text-align: center; background-color: #ffffff;} #box { position: absolute; left: 610px; top: 80px; height: 50px; width: 50px; background-color: #ff0000; color: #000000;} </style> <script type="text/javascript"> document.onkeydown=function(event){keyDown(event)}; document.onkeyup=function(event){keyUp(event)}; var box = 0; function Player () { var speed = 5; var x = 50; var y = 50; } function update() { box.style.left = this.x + "px"; box.style.top = this.y + "px"; box.innerHTML = "<h6 style=\"margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;\">X: "+ this.x + "<br /> Y: " + this.y + "</h6>"; } var player = new Player(); var keys = new Array(256); var i = 0; for (i = 0;i <= 256; i++){ keys[i] = false; } function keyDown(event){ keys[event.keyCode] = true; } function keyUp(event){ keys[event.keyCode] = false; } function update(){ if(keys[37]) player.x -= player.speed; if(keys[39]) player.x += player.speed; player.update(); } setInterval(update, 1000/60); </script> </head> <body> <div id="box" ></div> <script type="text/javascript"> box = document.getElementById('box'); box.innerHTML = "<h6 style=\"margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;\">X: "+ player.x + "<br /> Y: " + player.y + "</h6>"; </script> </body> </html>

    Read the article

  • As a programmer, how much time do you spend churning?

    - by Chinnery
    I recently went through a period of frustration, "churning" as I tried to set up my environment to work effectively on a task. By the time I broke through and started to make actual progress, I felt tired and kind of angry. (I'll admit: in this case, it took me several days of banging my head and ultimately starting from scratch to finally get around the problems.) This experience made me wonder: When a roadblock happens to other programmers, how long do they churn before finally becoming productive and beginning what feels like actual work?

    Read the article

  • Iterating through struct fieldnames in MATLAB.

    - by Noio
    My question is easily summarized as: "Why does the following not work?" teststruct = struct('a',3,'b',5,'c',9) fields = fieldnames(teststruct) for i=1:numel(fns) fns(i) teststruct.(fns(i)) end output: ans = 'a' ??? Argument to dynamic structure reference must evaluate to a valid field name. Especially since teststruct.('a') does work. And fns(i) prints out ans = 'a'. I can't get my head around it.

    Read the article

  • Creating a multiplatform webapp with HTML5 and Google maps

    - by Bart L.
    I'm struggling how to develop a webapp for Android and iOS. My first app was a simple todo app which was easy to test in my browser and it only used html, javascript and css. However, I have to create an app which uses Google Maps Api to get the location. I created a simple html5 page to test which places a marker on a map. It works fine when testing it on my local server. But when I create an .apk file for Android, the app doesn't work. So I'm wondering, isn't it possible to use it like this? Do I have the use the phonegap libraries to use their geolocation library? And if so, how do you handle the development of a webapp in phonegap for multiple OS? Do you have to install an Android environment and an iOS environment to each include the right phonegap library and to test them properly? Update: I use the following code on my webserver and it works perfectly. When I upload it in a zip-folder to the photogap cloud and install the APK file on my phone, it doesn't work. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Simple Geo test</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script> </head> <body> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> <script> function success(position) { var mapcanvas = document.createElement('div'); mapcanvas.id = 'mapcontainer'; mapcanvas.style.height = '200px'; mapcanvas.style.width = '200px'; document.querySelector('article').appendChild(mapcanvas); var coords = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); var options = { zoom: 15, center: coords, mapTypeControl: false, navigationControlOptions: { style: google.maps.NavigationControlStyle.SMALL }, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("mapcontainer"), options); var marker = new google.maps.Marker({ position: coords, map: map, title:"You are here!" }); } if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(success); } else { error('Geo Location is not supported'); } </script> <article></article> </body> </html>

    Read the article

  • CSS styles gone after Ajax call in IE 7

    - by roman m
    I've had a problem with my styles not being applied after AJAX calls. My styles were not in the < HEAD section of the page, and they were only recognized by IE on initial Page_Load. If you know of any other ways to fix this problem, post them here. This is more of a reference, hope this helps some people.

    Read the article

  • Are cookies enough for storing login data?

    - by jpjp
    I am reading the Head First PHP/Mysql book and they say to store both the user's username, email into cookies and sessions. Is it safe to assume that everyone nowadays accepts cookies? Or should I store both in sessions and cookies? I am not storing any sensitive data in cookies such as password, etc.

    Read the article

  • What are real world examples of when Linked Lists should be used?

    - by oo
    Another programmer was mentioning that they haven't found a use case for using a linked list data structure in any professional software in his career. I couldn't think of any good examples off the top of my head. He is mostly a C# and Java developer Can anyone give some examples where this was the correct data structure to solve a particular real world problem? Related: What is a practical, real world example of the Linked List?

    Read the article

  • CSS: right wrapper dropping off the end of the page

    - by user310606
    I have an issue with a site I am working on where the right wrapper keeps dropping down below the site. Obviously I want it to stay on the right hand side. I've coded up a test case which shows my issue (I think) and I'm wondering if there is a better way to do things. The website url is http://www.musicworkshop.co.nz/ Below is the test case which (I think) is the cause of my issue, however it may not be. The pink box drops down if it does not fit within the page width. Is there a better way to do this? John <html> <head> <title> Test page </title> <link rel="stylesheet" href="test.css" type="text/css" /> </head> <body> <div id="superbox"> <div id="box1"> </div> <div id="box2"> </div> <div id="box3"> </div> <div id="box4"> </div> <div id="box5"> </div> <div id="box6"> </div> </div> </body> </html> #outsidebox{ width: 100%; } #superbox{ width: 1000px; height: 100px; margin: 0 auto; } #box1{ height: 100px; width: 200px; background: red; float: left; } #box2{ height: 100px; width: 200px; background: yellow; float: left; } #box3{ height: 100px; width: 200px; background: blue; float: left; } #box4{ height: 100px; width: 200px; background: green; float: left; } #box5{ height: 100px; width: 200px; background: grey; float: left; } #box6{ height: 100px; width: 200px; background: pink; float: left; }

    Read the article

  • How to retrieve an input's value without the browser interpreting html special entities?

    - by CaptainQwyx
    Is there a way in JavaScript or MooTools to retrieve the actual text in the value from an input element without the browser interpreting any html special entites? Please see the example included below. My desired outcome is: <div id="output"> <p>Your text is: <b>[&lt;script&gt;alert('scrubbed');&lt;/script&gt;]</b></p> </div> Note that it works if I type/copy &lt;script&gt;alert('scrubbed');&lt;/script&gt; directly into the text input box, but fails if I insert right after loading the page. <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <title>scrubtest</title> </head> <body id="scrubtest" onload=""> <script type="text/javascript" language="JavaScript" src="/js/mootools-core.js"></script> <input type="text" name="scrubtext" value="&lt;script&gt;alert('scrubbed');&lt;/script&gt;" id="scrubtext"/><br /> <input type="button" value="Insert" onclick="insertText();"/><br /> <input type="button" value="Get via MooTools" onclick="alert($('scrubtext').get('value'));"/><br /> <input type="button" value="Get via JavaScript" onclick="alert(document.getElementById('scrubtext').value);"/><br /> <div id="output"> </div> <script type="text/javascript" charset="utf-8"> function insertText() { var stext = $('scrubtext').get('value'); var result = new Element( 'p', {html: "Your text is: <b>["+stext+"]</b>"} ); result.inject($('output')); } </script> </body> </html>

    Read the article

  • Google maps api v3: geocoding multiple addresses and infowindow

    - by user2536786
    I am trying to get infowindow for multiple addresses. Its creating markers but when I click on markers, infowindow is not popping up. Please help and see what could be wrong in this code. Rest all info is fine only issue is with infowindow not coming up. <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>Google Maps Multiple Markers</title> <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script> </head> <body> <div id="map" style="height: 800px;"></div> <script type="text/javascript"> var locations = [ ['Bondi Beach', '850 Bay st 04 Toronto, Ont'], ['Coogee Beach', '932 Bay Street, Toronto, ON M5S 1B1'], ['Cronulla Beach', '61 Town Centre Court, Toronto, ON M1P'], ['Manly Beach', '832 Bay Street, Toronto, ON M5S 1B1'], ['Maroubra Beach', '606 New Toronto Street, Toronto, ON M8V 2E8'] ]; var map = new google.maps.Map(document.getElementById('map'), { zoom: 10, center: new google.maps.LatLng(43.253205,-80.480347), mapTypeId: google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow(); var geocoder = new google.maps.Geocoder(); var marker, i; for (i = 0; i < locations.length; i++) { geocoder.geocode( { 'address': locations[i][1]}, function(results, status) { //alert(status); if (status == google.maps.GeocoderStatus.OK) { //alert(results[0].geometry.location); map.setCenter(results[0].geometry.location); marker = new google.maps.Marker({ position: results[0].geometry.location, map: map }); google.maps.event.addListener(marker, 'mouseover', function() { infowindow.open(marker, map);}); google.maps.event.addListener(marker, 'mouseout', function() { infowindow.close();}); } else { alert("some problem in geocode" + status); } }); } </script> </body> </html>

    Read the article

  • Hoe to convert a JSON array of paths to images stored on a server into a javaScript array to display them? Using AJAX

    - by MichaelF
    I need for html file/ ajax code to take the JSON message and store the PATHS as a javaScript array. Then my buildImage function can display the first image in the array. I'm new to AJAX and believe my misunderstanding lies within the converting of the JSON to Javascript. I'm confused also about if my code creates a JSON array or object or either. I might need also to download a library to my app to understand JSON? Below is a PHP file loading the paths of the images. I believe json ecode is converting the PHP Array in a Json message. <?php include("mysqlconnect.php"); $select_query = "SELECT `ImagesPath` FROM `offerstbl` ORDER by `ImagesId` DESC"; $sql = mysql_query($select_query) or die(mysql_error()); $data = array(); while($row = mysql_fetch_array($sql,MYSQL_BOTH)){ $data[] = $row['ImagesPath']; } echo $images = json_encode($data); ?> Below is the script in is going to be loaded on an Cordova app. <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="css/styles.css"> <link rel="stylesheet" href="css/cascading.css"> <script> function importJson(str) { // console.log(typeof xmlhttp.responseText); if (str=="") { document.getElementById("content").innerHTML=""; return; } if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { //var images = JSON.parse(xmlhttp.responseText); document.getElementById("content").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","http://server/content.php"); xmlhttp.send(); } function buildImage(src) { var img = document.createElement('img') img.src = src alert("1"); document.getElementById('content').appendChild(img); } for (var i = 0; i < images.length; i++) { buildImage(images[i]); } </script> </head> <body onload= "importJson();"> <div class="contents" id="content" ></div> <img src="img/logo.png" height="10px" width="10px" onload= "buildImage();"> </body>

    Read the article

  • How to "grep" out specific lline ranges of a file

    - by Mike
    There are often times I'll grep -l whatev file to find what I'm looking for. Say the output is 1234: whatev 1 5555: whatev 2 6643: whatev 3 If I want to then just extract the lines between 1234 and 5555, is there a tool to do that? For static files I have a script that does wc -l of the file and then does the math to split it out with tail & head but that doesn't work out so well with log files that are constantly being written to.

    Read the article

  • Using KnockoutJS 2.2.0 & jQuery 1.8.2 remove all bindings from all children of #someDiv

    - by Nukeface
    I'm wanting to delete All bindings (ko.cleanNode) from all child elements of a certain div. Must be a noobie question but I can't figure out how to use jQuery to loop through all childre, grand-children, great-grand-children, etc. whilst having KnockoutJS remove the bindings of all the DOM elements. I do NOT want to remove the elements from the DOM. This is a single page application, therefore the elements are pre-loaded as embedded resources and don't get resend to a client if they were to visit the page again. If a client revisits that part of the application I'll have a function rebind the necessary elements, which currently works fine. Current setup: <html> <head> //loading all resources </head> <body> //load first element using some obscure setup <div id="firsPage" data-role="page"> <div data-role="header">@Global.header</div> <div data-role="fieldcontain"> <label for="firstInput" /> <input id="firstInput some other stuff /> </div> <div data-role="datebox <!-- some settings --> > //creates table using jQuery mobile (lots of (great-)(grand-)children) </div> <div data-role="fieldcontain"> <div id="secondInput"> <div class="checklist"> <ul> <li /> <li /> </ul> </div> </div> </div> </div> //Here the whole thing starts again <div id="secondPage" data-role="page"> <!-- repeat above innerHTML in your mind ;) --> </div> //And here again! and again... </body> The problem I'm having is that bindings of the children don't seem to get "cleaned up" when i use ko.cleanNode($('#firstPage')[0]); Or when I get the Element into a variable and then format it to ko.cleanNode($element). Is there a way to do this? Been staring at it for a good few hours now, so probably overlooking a way too obvious way of doing it... Thanks!

    Read the article

  • Why this jquery plugin not working with 1.4.2

    - by metal-gear-solid
    http://plugins.jquery.com/project/semantictabs What is the means of this Status - Recommended for 1.0.x I'm using this plugin code as it is http://plugins.jquery.com/files/jquery.semantictabs.js_4.txt then this ( I'm also using prototype.js onsite) jQuery.noConflict(); jQuery(document).ready(function(){ $("#mytabset").semantictabs({ panel:'.mypanelclass', //-- Selector of individual panel body head:'headelement', //-- Selector of element containing panel header, i.e. h3 active:':first' //-- Which panel to activate by default }); });

    Read the article

  • How do you hide an image tag based on an ajax response?

    - by Chris
    What is the correct jquery statement to replace the "//Needed magic" comments below so that the image tags are hidden or unhidden based on the AJAX responses? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>JQuery</title> <style type="text/css"> .isSolvedImage{ width: 68px; height: 47px; border: 1px solid red; cursor: pointer; } </style> <script src="_js/jquery-1.4.2.min.js" type="text/javascript"> </script> </head> <body> <div id='true1.txt' class='isSolvedImage'> <img src="_images/solved.png"> </div> <div id='false1.txt' class='isSolvedImage'> <img src="_images/solved.png"> </div> <div id='true2.txt' class='isSolvedImage'> <img src="_images/solved.png"> </div> <div id='false2.txt' class='isSolvedImage'> <img src="_images/solved.png"> </div> <script type="text/javascript"> $(function(){ var getDivs = 0; //iterate div with class isSolvedImage $("div.isSolvedImage").each(function() { alert('div id--'+this.id); // send ajax requrest $.get(this.id, function(data) { // check if ajax response is 1 alert('div id--'+this.url+'--ajax response--'+data); if(data == 1){ alert('div id--'+this.url+'--Unhiding image--'); //Needed magic //Show image if data==1 } else{ alert('div id--'+this.url+'--Hiding image--'); //Needed magic //Hide image if data!=1 } }); }); }); </script> </body> </html>

    Read the article

< Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >