Search Results

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

Page 108/260 | < Previous Page | 104 105 106 107 108 109 110 111 112 113 114 115  | Next Page >

  • What is the difference between these 2 XML LINQ Queries?

    - by Jon
    I have the 2 following LINQ queries and I haven't quite got my head around LINQ so what is the difference between the 2 approaches below? Is there a circumstance where one approach is better than another? ChequeDocument.Descendants("ERRORS").Where(x=>(string)x.Attribute("D") == "").Count(); (from x in ChequeDocument.Descendants("ERRORS") where (string)x.Attribute("D") == "" select x).Count())

    Read the article

  • jQuery: Need to "refresh" a widget.

    - by Legend
    I am adapting the Coverflow technique to work with a div. The coverflow function (included as a js file in the head section) is here. When I dynamically add a DIV, it doesn't show up in the coverflow. I am wondering if there is a way to add a destroy function to this js file so that whenever a new div add is added, I can call the destroy method and then reinstantiate. Any suggestions on how I should go about doing this?

    Read the article

  • Jquery - Loading a page with .load and selector doesn't execute script?

    - by PirateKitten
    I'm trying to load one page into another using the .load() method. This loaded page contains a script that I want to execute when it has finished loading. I've put together a barebones example to demonstrate: Index.html: <html> <head> <title>Jquery Test</title> <script type="text/javascript" src="script/jquery-1.3.2.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#nav a').click(function() { $('#contentHolder').load('content.html #toLoad', '', function() {}); return false; }); }); </script> </head> <body> <div id="nav"> <a href="content.html">Click me!</a> </div> <hr /> <div id="contentHolder"> Content loaded will go here </div> </body> </html> Content.html: <div id="toLoad"> This content is from content.html <div id="contentDiv"> This should fade away. </div> <script type="text/javascript"> $('#contentDiv').fadeOut('slow', function() {} ); </script> </div> When the link is clicked, the content should load and the second paragraph should fade away. However it doesn't execute. If I stick a simple alert("") in the script of content.html it doesn't execute either. However, if I do away with the #toLoad selector in the .load() call, it works fine. I am not sure why this is, as the block is clearly in the scope of the #toLoad div. I don't want to avoid using the selector, as in reality the content.html will be a full HTML page, and I'll only want a select part out of it. Any ideas? If the script from content.html was in the .load() callback, it works fine, however I obviously don't want that logic contained within index.html. I could possibly have the callback use .getScript() to load "content.html.js" afterwards and have the logic in there, that seems to work? I'd prefer to keep the script in content.html, if possible, so that it executes fine when loaded normally too. In fact, I might do this anyway, but I would like to know why the above doesn't work.

    Read the article

  • Using JSON Data to Populate a Google Map with Database Objects

    - by MikeH
    I'm revising this question after reading the resources mentioned in the original answers and working through implementing it. I'm using the google maps api to integrate a map into my Rails site. I have a markets model with the following columns: ID, name, address, lat, lng. On my markets/index view, I want to populate a map with all the markets in my markets table. I'm trying to output @markets as json data, and that's where I'm running into problems. I have the basic map displaying, but right now it's just a blank map. I'm following the tutorials very closely, but I can't get the markers to generate dynamically from the json. Any help is much appreciated! Here's my setup: Markets Controller: def index @markets = Market.filter_city(params[:filter]) respond_to do |format| format.html # index.html.erb format.json { render :json => @market} format.xml { render :xml => @market } end end Markets/index view: <head> <script type="text/javascript" src="http://www.google.com/jsapi?key=GOOGLE KEY REDACTED, BUT IT'S THERE" > </script> <script type="text/javascript"> var markets = <%= @markets.to_json %>; </script> <script type="text/javascript" charset="utf-8"> google.load("maps", "2.x"); google.load("jquery", "1.3.2"); </script> </head> <body> <div id="map" style="width:400px; height:300px;"></div> </body> Public/javascripts/application.js: function initialize() { if (GBrowserIsCompatible() && typeof markets != 'undefined') { var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(40.7371, -73.9903), 13); map.addControl(new GLargeMapControl()); function createMarker(latlng, market) { var marker = new GMarker(latlng); var html="<strong>"+market.name+"</strong><br />"+market.address; GEvent.addListener(marker,"click", function() { map.openInfoWindowHtml(latlng, html); }); return marker; } var bounds = new GLatLngBounds; for (var i = 0; i < markets.length; i++) { var latlng=new GLatLng(markets[i].lat,markets[i].lng) bounds.extend(latlng); map.addOverlay(createMarker(latlng, markets[i])); } } } window.onload=initialize; window.onunload=GUnload;

    Read the article

  • Simple Scala actor question

    - by 7zark7
    I'm sure this is a very simple question, but embarrassed to say I can't get my head around it: I have a list of values in Scala. I would like to use use actors to make some (external) calls with each value, in parallel. I would like to wait until all values have been processed, and then proceed. There's no shared values being modified. Could anyone advise? Thanks

    Read the article

  • mysql insert and buffers, is this possible

    - by Grumpy
    how is this possible first i do insert into table2 select * from table1 where table1.id=1 ( 50k records should be moved 6 indexes has to be updated ) second delete from table1 where id=1 ( 50k records are removed ) How is it possible that only 45k of records are moved? Im scratching my head over this and cant find a right answer Is it possible that the insert is still active and delete already started

    Read the article

  • change maxlength depending of the option selected

    - by tuner3000
    I've seen similar questions posted and tried to change them to meet my needs but I don't know enough about javascript to do it. I need that when a user change the dropdown select, the "titre text field" maxlength is dynamically changed a, b c and d max maxlength should be 40 and e maxlength should be 2 my code is below, I don't know why but it is not working correctly: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>title page</title> </head> <body> <script type="text/javascript"> function changeValue(dropdown) { var option = dropdown.options[dropdown.selectedIndex].value, field = document.getElementById('titre'); if (option == 'a' || option == 'b' || option == 'c' || option == 'd') { field.maxLength = 40; } else if (option == 'e') { field.value = field.value.substr(0, 2); // before reducing the maxlength, make sure it contains at most two characters; you could also reset the value altogether field.maxLength = 2; } }? </script> <form action="converter.php" method="post"> <h2>Feel all field below:</h2> <div> Title: <input type="texte" name="titre" id="titre" maxLength="40"/> Format: <select id="format" name="format" onchange="changeValue(this);"> <option value="a">A</option> <option value="b">B</option> <option value="c">C</option> <option value="d">D</option> <option value="e">E</option> </select> </div> <div> <textarea name="texte" style="width: 415px; height: 155px;"></textarea> </div> <div> <input type="submit" value="OK" /> </div> </form> </body> </html>

    Read the article

  • go programming POST FormValue can't be printed

    - by poor_programmer
    Before I being a bit of background, I am very new to go programming language. I am running go on Win 7, latest go package installer for windows. I'm not good at coding but I do like some challenge of learning a new language. I wanted to start learn Erlang but found go very interesting based on the GO I/O videos in youtube. I'm having problem with capturing POST form values in GO. I spend three hours yesterday to get go to print a POST form value in the browser and failed miserably. I don't know what I'm doing wrong, can anyone point me to the right direction? I can easily do this in another language like C#, PHP, VB, ASP, Rails etc. I have search the entire interweb and haven't found a working sample. Below is my sample code. Here is Index.html page {{ define "title" }}Homepage{{ end }} {{ define "content" }} <h1>My Homepage</h1> <p>Hello, and welcome to my homepage!</p> <form method="POST" action="/"> <p> Enter your name : <input type="text" name="username"> </P> <p> <button>Go</button> </form> <br /><br /> {{ end }} Here is the base page <!DOCTYPE html> <html lang="en"> <head> <title>{{ template "title" . }}</title> </head> <body> <section id="contents"> {{ template "content" . }} </section> <footer id="footer"> My homepage 2012 copy </footer> </body> </html> now some go code package main import ( "fmt" "http" "strings" "html/template" ) var index = template.Must(template.ParseFiles( "templates/_base.html", "templates/index.html", )) func GeneralHandler(w http.ResponseWriter, r *http.Request) { index.Execute(w, nil) if r.Method == "POST" { a := r.FormValue("username") fmt.Fprintf(w, "hi %s!",a); //<-- this variable does not rendered in the browser!!! } } func helloHandler(w http.ResponseWriter, r *http.Request) { remPartOfURL := r.URL.Path[len("/hello/"):] fmt.Fprintf(w, "Hello %s!", remPartOfURL) } func main() { http.HandleFunc("/", GeneralHandler) http.HandleFunc("/hello/", helloHandler) http.ListenAndServe("localhost:81", nil) } Thanks! PS: Very tedious to add four space before every line of code in stackoverflow especially when you are copy pasting. Didn't find it very user friendly or is there an easier way?

    Read the article

  • Infinite Refresh Loop in Firefox 3.0

    - by Martin Gordon
    I'm having a strange issue with my Javascript in Firefox 3.0.x. In Firefox 3.0.12, the page constantly reloads as soon as the list body is loaded. Neither Firefox 3.5, Safari 4 nor Chrome 5 (all on Mac) experience this issue. EDIT: I've created an isolated example rather than pulling this from my existing code. test.js function welcomeIndexOnLoad() { $("#options a").live('click', function () { optionClicked($(this), "get_list_body.html"); return false; }); $(document).ready(function() { optionClicked(null, "get_list_body.html"); }); } function optionClicked(sender, URL) { queryString = ""; if (sender != null) { queryString = $(sender).attr("rel"); } $("#list_body").load(URL + "?" + queryString, function(resp, status, AJAXReq) { console.log(resp); console.log("" + status); location.hash = queryString; }); }? test.html <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script> <script type="text/javascript" src="test.js"></script> <script> welcomeIndexOnLoad(); </script> </head> <body> <div id="container"> Outside of list body. <div id="list_body"> </div> </div> </body> </html> get_list_body.html <h3> <div id="options"> <a href="#" rel="change_list">Change List</a> </div> <ul> <li>li</li> </ul> jQuery line 5252 (an xhr.send() call) shows up in the console as soon as the page reloads: xhr.send( type === "POST" || type === "PUT" || type === "DELETE" ? s.data : null );

    Read the article

  • How set the response header's Cache-Control in Sitecore?

    - by user822211
    By default, it looks like Sitecore does not cache pages. In web.config, set this <setting name="DisableBrowserCaching" value="false"/> and create pipeline processor page.Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)); page.Response.Cache.SetCacheability(HttpCacheability.Public); but it did not work, the repose head stays no-cache. By the way, I add the pipeline in the renderLayout, anyone knows? thanks!

    Read the article

  • php database image show problem

    - by Termedi
    here is the code <?php session_start(); if(!isset($_SESSION['user_name'])) { header('Location: login.php'); } $conn = mysql_connect("localhost", "root", "") or die("Can no connect to Database Server"); ?> <html> <head> </head> <body> <center> <div id="ser"> <form action="" method="post"> <label for="file">Card No:</label> <input type="text" name="card_no" id="card_no" class="fil" onKeyUp="CardNoLength()" onKeyDown="CardNoLength()" onKeyPress="CardNoLength()"/> <input type="submit" name="search" value="Search" class="btn" onClick="return CardNoLengthMIN()"/> </form> </div> </center> <br/><hr style="border: 1px solid #606060 ;" /> <center><a href="index.php">Home</a></center> <br/> <center> <?php if(isset($_POST['card_no'])) { if($conn) { if(mysql_select_db("img_mgmt", $conn)) { $sql = "select * from temp_images where card_no='".trim($_POST['card_no'])."'"; $result = mysql_query($sql); $image = mysql_fetch_array($result); if(isset($image['card_no'])) { //echo "<img src=\"".$image['file_path']."\" alt=\"".$image['card_no']."\" width=\"250\" height=\"280\"/>"; header("Content-type: image/jpeg"); echo $image['img_content']; } else { echo "<p style=\"color:red;\">Sorry, Your search came with no results ! <br/> Try with different card number"; } } else { echo "Database selection error: ".mysql_error(); } } else { echo "Could not connect: ".mysql_error(); } } ?> </center> </body> </html> But it after executing the script it shows: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\img\search.php:61) in C:\xampp\htdocs\img\search.php on line 77

    Read the article

  • First record does not show in pagination script

    - by whitstone86
    This is my pagination script which extracts info for my TV guide project that I am working on. Currently I've been experimenting with different PHP/MySQL before it becomes a production site. This is my current script: <?php /*********************************** * PhpMyCoder Paginator * * Created By PhpMyCoder * * 2010 PhpMyCoder * * ------------------------------- * * You may use this code as long * * as this notice stays intact and * * the proper credit is given to * * the author. * ***********************************/ // set the default timezone to use. Available since PHP 5.1 putenv("TZ=US/Eastern") ?> <head> <title> Pagination Test - Created By PhpMyCoder</title> <style type="text/css"> #nav { font: normal 13px/14px Arial, Helvetica, sans-serif; margin: 2px 0; } #nav a { background: #EEE; border: 1px solid #DDD; color: #000080; padding: 1px 7px; text-decoration: none; } #nav strong { background: #000080; border: 1px solid #DDD; color: #FFF; font-weight: normal; padding: 1px 7px; } #nav span { background: #FFF; border: 1px solid #DDD; color: #999; padding: 1px 7px; } </style> </head> <?php //Require the file that contains the required classes include("pmcPagination.php"); //PhpMyCoder Paginator $paginator = new pmcPagination(20, "page"); //Connect to the database mysql_connect("localhost","root","PASSWORD"); //Select DB mysql_select_db("mytvguide"); //Select only results for today and future $result = mysql_query("SELECT programme, channel, airdate, expiration, episode, setreminder FROM lagunabeach where expiration >= now() order by airdate, 3 ASC LIMIT 0, 100;"); //You can also add reuslts to paginate here mysql_data_seek($queryresult,0) ; while($row = mysql_fetch_array($result)) { $paginator->add(new paginationData($row['programme'], $row['channel'], $row['airdate'], $row['expiration'], $row['episode'], $row['setreminder'])); } ?> <?php //Show the paginated results $paginator->paginate (); ?><? include("pca-footer1.php"); ?> <?php //Show the navigation $paginator->navigation(); ?> Despite me having two records for the programmes airing today, it only shows records from the second one onwards - the programme that airs at 8:35pm UK time GMT does not show, but the later 11:25pm UK time GMT one does show. How should I fix this? Above is my code if that is of any use! Thanks

    Read the article

  • How can I embed a conditional comment for IE with innerHTML?

    - by Samuel Charpentier
    Ok so I want to conditionally add this line of code; <!--[if ! IE]> <embed src="logo.svg" type="image/svg+xml" /> <![endif]--> Using: document.getElementById("logo") .innerHTML='...'; In a if()/else() statement and it don't write it! If i get rid of the selective comment ( <!--[if ! IE]><![endif]-->) and only put the SVG ( <embed src="logo.svg" type="image/svg+xml" /> ) it work! what should I do? I found a way around but i think in the Android browser the thing will pop up twice. here's what I've done ( and its Validated stuff!); <!DOCTYPE html> <html> <head> <META CHARSET="UTF-8"> <title>SVG Test</title> <script type="text/javascript"> //<![CDATA[ onload=function() { var ua = navigator.userAgent.toLowerCase(); var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile"); if(isAndroid) { document.getElementById("logo").innerHTML='<img src="fin_palais.png"/>'; } } //]]> </script> </head> <body> <div id="logo"> <!--[if lt IE 9]> <img src="fin_palais.png"/> <![endif]--> <!--[if gte IE 9]><!--> <embed src="fin_palais.svg" type="image/svg+xml" /> <!--<![endif]--> </div> </body>

    Read the article

  • javascript JSONP callback function not defined

    - by bitsMix
    ( function restoreURL() { function turnLongURL(data) { window.location = data.url; } var shortUrl = window.location.href; var url = "http://json-longurl.appspot.com/?url=" + shortUrl + "&callback=turnLongURL"; var script = document.createElement('script'); script.setAttribute('src', url); document.getElementsByTagName('head')[0].appendChild(script); })(); code is above, but the firebug told me, turnLongURL is not defined why is that?

    Read the article

  • Simple html page using Bootstrap

    - by Athashri
    I am writing a simple HTML page using the Twitter Bootstrap. But the navbar and links are rendered as normal HTML on the browser. I have referred to multiple sites but the same steps are given everywhere. I am not sure where I am going wrong. Code: <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <link rel= "stylesheet" href= "css/bootstrap.css" type="text/css"> <title> Bootstrap example</title> </head> <body> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="js/bootstrap.js"></script> <h1>Hello, world!</h1> <div class ="container"> <h1><a href="#">Bootstrap Site</a></h1> <div class="navbar"> <div class="navbar-inner"> <div class="container"> <ul class="nav"> <li class="active"><a href="#">Home</a></li> <li><a href="#">Projects</a></li> <li><a href="#">Services</a></li> <li><a href="#">Downloads</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> </div> </div> </div> </div> </body> </html>

    Read the article

  • PHP Using session variables in array(s)

    - by Chris
    Hello, My question is how do i put these session variables into a array? I have tried countless ways but none of them work. Not really sure what to put in a array and what no and how to adress them. Currently when i fill in the form the data gets displayed in a table. Next when i press the hyperlink that takes me back to the same form, i wish to enter data again. This data should be added in a new row in the same display table. Best Regards. The code below (pardon me that it is not english). <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>ExpoFormulier</title> <body> <?php if (!empty($_POST)) { $standnaam = $_POST["standnaam"]; $oppervlakte = $_POST["oppervlakte"]; //value in the form van checkboxes op 1 zetten! $verdieping = isset($_POST["verdieping"]) ? $_POST["verdieping"] : 0; $telefoon = isset($_POST["telefoon"]) ? $_POST["telefoon"] : 0; $netwerk = isset($_POST["netwerk"]) ? $_POST["netwerk"] : 0; if (is_numeric($oppervlakte)) { $_SESSION["standnaam"]=$standnaam; $_SESSION["oppervlakte"]=$oppervlakte; $_SESSION["verdieping"]=$verdieping; $_SESSION["telefoon"]=$telefoon; $_SESSION["netwerk"]=$netwerk; header("Location:ExpoOverzicht.php"); } else { echo "<h1>Foute gegevens, Opnieuw invullen a.u.b</h1>"; } } ?> <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" id="form1"> <h1>Vul de gegevens in</h1> <table> <tr> <td>Standnaam:</td> <td><input type="text" name="standnaam" size="18"/></td> </tr> <tr> <td>Oppervlakte (in m^2):</td> <td><input type="text" name="oppervlakte" size="6"/></td> </tr> <tr> <td>Verdieping:</td> <td><input type="checkbox" name="verdieping" value="1"/></td> </tr> <tr> <td>Telefoon:</td> <td><input type="checkbox" name="telefoon" value="1"/></td> </tr> <tr> <td>Netwerk:</td> <td><input type="checkbox" name="netwerk" value="1"/></td> </tr> <tr> <td><input type="submit" name="verzenden" value="Verzenden"/></td> </tr> </table> </form> Second File: <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>ExpoOverzicht</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link href="StyleSheetExpo.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Overzicht van de ingegeven standen in deze sessie</h1> <?php $standnaam = $_SESSION["standnaam"]; $oppervlakte = $_SESSION["oppervlakte"]; $verdieping = $_SESSION["verdieping"]; $telefoon = $_SESSION["telefoon"]; $netwerk = $_SESSION["netwerk"]; $result1 = 0; $result2 = 0; $result3 = 0; $prijsCom = 0; $prijsVerdieping = 0; for ($i=1; $i <= $oppervlakte; $i++) { if($i <= 10) { $tarief1 = 1 * 100; $result1 += $tarief1; } if($i > 10 && $i <= 30) { $tarief2 = 1 * 90; $result2 += $tarief2; } if($i > 30) { $tarief3 = 1 * 80; $result3 += $tarief3; } } $prijsOpp = $result1 + $result2 + $result3; if($verdieping == 1) { $prijsVerdieping = $oppervlakte * 120; } if(($telefoon == 1) || ($netwerk == 1)) { $prijsCom = 20; } if(($telefoon == 1) && ($netwerk == 1)) { $prijsCom = 30; } $totalePrijs = $prijsOpp + $prijsVerdieping + $prijsCom; echo "<table class=\"tableExpo\">"; echo "<th>Standnaam</th>"; echo "<th>Oppervlakte</th>"; echo "<th>Verdieping</th>"; echo "<th>Telefoon</th>"; echo "<th>Netwerk</th>"; echo "<th>Totale prijs</th>"; echo "<tr>"; echo "<td>".$standnaam."</td>"; echo "<td>".$oppervlakte."</td>"; echo "<td>".$verdieping."</td>"; echo "<td>".$telefoon."</td>"; echo "<td>".$netwerk."</td>"; echo "<td>".$totalePrijs."</td>"; echo "</tr>"; echo "</table>"; ?> <a href="ExpoFormulier.php">Terug naar het formulier</a> </body> </html> </body> </html>

    Read the article

  • How can i put my form value in javascript array

    - by Lucas van den Abbeele
    I want to make a script where i can put my form in the javascript array invoer[] and display the total It constantly stops working and i searched a lot, i really can't find the right way :D This is my javascript code var strijk = ['broek', 'hemd', 'tshirt', 'lakens', 'korte broek', 'babykledij']; var minuten = [5, 10, 5, 6, 3, 3]; function invoerstrijk() { document.write("<form action='' method='get' name='strijkform'>"); for (var a = 0; a < minuten.length; a++) { document.write(strijk[a] + "<input id='" + strijk[a] + "' name ='" + strijk[a] + "' type='text' />" + "<BR>"); } document.write("<button onclick='opgeven()'>opgeven</button>"); document.write("</form>"); } function opgeven() { var invoer = []; for (var a = 0; a < minuten.length; a++) { invoer[a] = document.getElementByI(strijk[a]).value; } var totaal; for (var a = 0; a < minuten.length; a++) { totaal += parseint(invoer[a]) * parseint(minuten[a]); } document.write("<input name=" + strijk[a] + " type='text' value=" + invoer[a] + " readonly />"); if (invoer != []) { document.write("totaal aantal minuten" + totaal); } else { document.write("geen invoer"); } } my html looks likes this <!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=utf-8" /> <title>Untitled Document</title> </head> <body> <script type="text/javascript" > //my javasccript </script> <button id="B1" onclick="invoerstrijk()" >Nieuwe strijk</button> </body> </html>

    Read the article

  • Rails 3: How do I call a javascript function from a js.erb file

    - by user321775
    Now that I've upgraded to Rails 3, I'm trying to figure out the proper way to separate and reuse pieces of javascript. Here's the scenario I'm dealing with: I have a page with two areas: one with elements that should be draggable, the other with droppables. When the page loads I use jQuery to setup the draggables and droppables. Currently I have the script in the head portion of application.html.erb, which I'm sure is not the right solution but at least works. When I press a button on the page, an ajax call is made to my controller that replaces the draggables with a new set of elements that should also be draggable. I have a js.erb file that renders a partial in the correct location. After rendering I need to make the new elements draggable, so I'd like to reuse the code that currently lives in application.html.erb, but I haven't found the right way to do it. I can only make the new elements draggable by pasting the code directly into my js.erb file (yuck). What I'd like to have: - a javascript file that contains the functions prepdraggables() and prepdroppables() - a way to call either function from application.html.erb or from a js.erb file I've tried using :content_for to store and reuse the code, but can't seem to get it working correctly. What I currently have in the head section of application.html.erb <% content_for :drag_drop_prep do %> <script type="text/javascript" charset="utf-8"> $(document).ready(function () { // declare all DOM elements with class draggable to be draggable $( ".draggable" ).draggable( { revert : 'invalid' }); // declare all DOM elements with class legal to be droppable $(".legal").droppable({ hoverClass : 'legal_hover', drop : function(event, ui) { var c = new Object(); c['die'] = ui.draggable.attr("id"); c['cell'] = $(this).attr("id"); c['authenticity_token'] = encodeURIComponent(window._token); $.ajax({ type: "POST", url: "/placeDie", data: c, timeout: 5000 }); }}); }); </script> <% end %> undo.js.erb $("#board").html("<%= escape_javascript(render :partial => 'shared/board', :locals => { :playable => true, :restartable => !session[:challenge]}) %>") // This is where I want to prepare draggables. <%= javascript_include_tag "customdragdrop.js" %> // assuming this file had the draggables code from above in a prepdraggables() function prepdraggables();

    Read the article

  • how to update only the updated rows in gridview?

    - by user603007
    what is the handiest way to update only the updated rows (only the checkbox column) in this gridview? what is a handy way to check wether the row was updated? c# public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { List<customer> listCustomer = new List<customer>(); customer cust1 = new customer(){name="fred",email="[email protected]",jobless="true"}; customer cust2 = new customer(){name="mark",email="[email protected]",jobless="false"}; listCustomer.Add(cust1); listCustomer.Add(cust2); GridView1.DataSource=listCustomer; GridView1.DataBind(); } } protected void btnUpdate_Click1(object sender, EventArgs e) { foreach (GridViewRow rw in GridView1.Rows) { CheckBox thiscontrol = (CheckBox)rw.Cells[0].FindControl("cb"); var ch = thiscontrol.Checked; //only update the updated rows? } } public class customer { public string name { get; set; } public string email { get; set; } public string jobless { get; set; } } html <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="gridviewUpdate._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> <form id="form1" runat="server"> <div> <asp:GridView ID="GridView1" AutoGenerateColumns="false" runat="server"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox ID="jobless" runat="server" Checked='<%# Eval("jobless").ToString().Equals("true") %>' /> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="email" /> <asp:BoundField DataField="name" /> </Columns> </asp:GridView> </div>

    Read the article

  • Returning currently displayed index of an array Javascript...

    - by Jeff Kindred
    I have a simple array with x number of items. I am displaying them individually via a link click... I want to update a number that say 1 of 10. when the next one is displayed i want it to display 2 of 10 etc... I have looked all around and my brain is fried right now... I know its simple I just cant get it out. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Page Title</title> <link rel="stylesheet" href="style.css" type="text/css" media="screen" charset="utf-8"/> <script type="text/javascript"> var quotations = new Array() quotations[0]= "1" quotations[1]= "2" quotations[2]= "3" quotations[3]= "4" quotations[4]= "5" quotations[5]= "6" quotations[6]= "7" numQuotes = quotations.length; curQuote = 1; function move( xflip ) { curQuote = curQuote + xflip; if (curQuote > numQuotes) { curQuote = 1 ; } if (curQuote == 0) { curQuote = numQuotes ; } document.getElementById('quotation').innerHTML=quotations[curQuote - 1]; } var curPage = //this is where the current index should go </script> </head> <body> <div id="quotation"> <script type="text/javascript">document.write(quotations[0]);</script> </div> <div> <p><a href="javascript();" onclick="move(-1)">GO back</a> <script type="text/javascript">document.write(curPage + " of " + numQuotes)</script> <a href="javascript();" onclick="move(1)">GO FORTH</a></p> </div> </body> </html>

    Read the article

  • ASP.NET Drop Down list , the button function not firing after the first click

    - by Pinu
    ASP.Net Dropdownlist , on changing the value of drop down list and clicking the button it is not sending an upadted value to the New.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test_DropDown.aspx.cs" Inherits="Test_DropDown" % <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:DropDownList ID="ddl_test" runat="server" OnSelectedIndexChanged="ddl_test_SelectedIndexChanged" AutoPostBack="true"> <asp:ListItem>First Item</asp:ListItem> <asp:ListItem>Second Item</asp:ListItem> <asp:ListItem>Third Item</asp:ListItem> </asp:DropDownList> <asp:HiddenField ID="hdf_ddl" runat="server" /> <asp:Button ID="btn_test" runat="server" Text="Button" OnClick="Button1_Click" /> </div> </form> </body> </html> using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Test_DropDown : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { string passValue = ddl_test.SelectedValue.ToString(); string val = hdf_ddl.Value.ToString(); btn_test.Attributes.Add("onclick", "window.open('New.aspx?ddlValue=" + val + "', 'OpenPopWindow','left=250,top=100,width=500,height=500,toolbar=1,resizable=0,status=0,menubar=0,scrollbars=1');return false;"); //btn_test.OnClientClick = "window.open('New.aspx?ddlValue=" + val + "', 'OpenPopWindow','left=250,top=100,width=500,height=500,toolbar=1,resizable=0,status=0,menubar=0,scrollbars=1');return false;"; } protected void ddl_test_SelectedIndexChanged(object sender, EventArgs e) { hdf_ddl.Value = ddl_test.SelectedValue.ToString(); } }

    Read the article

  • How to write an RDF Schema?

    - by trickdev
    I am trying to get my head around using RDF to describe custom resources. I understand there are xmlns' out there such as Dublin Core and foaf which provide predefined element sets. How do I go about creating my own? I may be barking up the wrong tree of course and should stick to xml + xsd?

    Read the article

  • [jQuery] JS inside the template

    - by Martin Trigaux
    Hello, I'm trying to include some javascript code inside a template. The code of my html page : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <script type="text/javascript" src="jquery-1.4.2.min.js"></script> <script type="text/javascript" src="jquery-jtemplates.js"></script> </head> <body> <div id="infos"></div> <div id="my_template"></div> <script type="text/javascript"> $(document).ready(function() { $('#my_template').setTemplateURL("my_template.html"); try { $('#my_template').processTemplate({'var' : 1}); } catch (e) { $('#infos').html('error : '+e); } $('#my_button').click(function(){ alert('it works outside'); }); }); </script> </body> </html> and the template content of the template<br/> {#if $T.var == 1} <script type="text/javascript"> $(document).ready(function() { $('#my_button').click(function(){ alert('it works inside'); }); }); </script> <input type='submit' id='my_button' value='click me' onclick='alert("direct");'/> {#else} not working {#/if} produce me an error inside the infos balise error : SyntaxError: missing } after function body if I just put alert('it works inside'); inside the script balise (remove all the jquery related code), the page load, the two message "direct" and "it works outside" are showed but not "it works inside" message. It's suppose to works as said on the doc page Allow to use JavaScript code in templates Thank you

    Read the article

  • How can i maintain last cookie value in flex with jsp?

    - by praveen
    Hi All, my login form in flex when I login I have created a cookie in jsp like this name setValueCookie.jsp <%@ page language="java" import="java.util.* , javax.net.*" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <% String username = request.getParameter("value"); System.out.println("Email got in cookieSet = " + username); if(username==null) username=""; Date now = new Date(); String timestamp = now.toString(); Cookie cookie = new Cookie("username",username); cookie.setMaxAge(365 * 24 * 60 * 60); response.addCookie(cookie); %> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>DashBoard-Cookie</title> </head> <body> </body> </html> now using Http service request parameter i am passing username 'Value' to this jsp. and i am reading cookie value from getValueCookie.jsp like this <% String cookieName = "username"; Cookie cookies [] = request.getCookies (); Cookie myCookie = null; String result; if (cookies != null) { for (int i = 0; i < cookies.length; i++) { if (cookies [i].getName().equals (cookieName)) { myCookie = cookies[i]; break; } } } %> <data> <status><%=myCookie.getValue().toString()%></status> </data> through the httpservice value i am getting but if i open a new window or any new tab cookie value is not getting how can i solve this? Thanks in advance.

    Read the article

< Previous Page | 104 105 106 107 108 109 110 111 112 113 114 115  | Next Page >