Search Results

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

Page 58/260 | < Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >

  • How to change attribute on Scala XML Element

    - by Dave
    I have an XML file that I would like to map some attributes of in with a script. For example: <a> <b attr1 = "100" attr2 = "50"> </a> might have attributes scaled by a factor of two: <a> <b attr1 = "200" attr2 = "100"> </a> This page has a suggestion for adding attributes but doesn't detail a way to map a current attribute with a function (this way would make that very hard): http://www.scalaclass.com/book/export/html/1 What I've come up with is to manually create the XML (non-scala) linked-list... something like: // a typical match case for running thru XML elements: case Elem(prefix, e, attributes, scope, children @ _*) => { var newAttribs = attributes for(attr <- newAttribs) attr.key match { case "attr1" => newAttribs = attribs.append(new UnprefixedAttribute("attr1", (attr.value.head.text.toFloat * 2.0f).toString, attr.next)) case "attr2" => newAttribs = attribs.append(new UnprefixedAttribute("attr2", (attr.value.head.text.toFloat * 2.0f).toString, attr.next)) case _ => } Elem(prefix, e, newAttribs, scope, updateSubNode(children) : _*) // set new attribs and process the child elements } Its hideous, wordy, and needlessly re-orders the attributes in the output, which is bad for my current project due to some bad client code. Is there a scala-esque way to do this?

    Read the article

  • jQuery Collapse (with cookies), default open instead of closed?

    - by Christian
    Hi. I've got a jQuery snippet which basically allows a user to toggle a div, open or closed - their preference is saved in a cookie. (function($) { $.fn.extend({ collapse: function(options) { var defaults = { inactive : "inactive", active : "active", head : ".trigger", group : ".wrap-me-up", speed : 300, cookie : "collapse" }; // Set a cookie counter so we dont get name collisions var op = $.extend(defaults, options); cookie_counter = 0; return this.each(function() { // Increment cookie name counter cookie_counter++; var obj = $(this), sections = obj.find(op.head).addClass(op.inactive), panel = obj.find(op.group).hide(), l = sections.length, cookie = op.cookie + "_" + cookie_counter; // Look for existing cookies for (c=0;c<=l;c++) { var cvalue = $.cookie(cookie + c); if ( cvalue == 'open' + c ) { panel.eq(c).show(); panel.eq(c).prev().removeClass(op.inactive).addClass(op.active); }; }; sections.click(function(e) { e.preventDefault(); var num = sections.index(this); var cookieName = cookie + num; var ul = $(this).next(op.group); // If item is open, slide up if($(this).hasClass(op.active)) { ul.slideUp(op.speed); $(this).removeClass(op.active).addClass(op.inactive); $.cookie(cookieName, null, { path: '/', expires: 10 }); return } // Else slide down ul.slideDown(op.speed); $(this).addClass(op.active).removeClass(op.inactive); var cookieValue = 'open' + num; $.cookie(cookieName, cookieValue, { path: '/', expires: 10 }); }); }); } }); })(jQuery); Demo: http://christianbullock.com/demo/ I'm just wondering how I can display the list open as default, and have the div collapse when the header is clicked? Many thanks. Christian.

    Read the article

  • Create xml document in java applet.

    - by zproxy
    If I try to create a new xml document in a java applet by this code: http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#newInstance() DocumentBuilderFactory.newInstance(); I will get this error: Java Plug-in 1.6.0_19 Using JRE version 1.6.0_19-b04 Java HotSpot(TM) Client VM javax.xml.parsers.FactoryConfigurationError: Provider <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> not found at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source) I do not care about DTD's. Why is it looking for it? How am I supposed to create a xml document in java applets? How can I make it work? The enclosing html document looks like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Loading...</title> </head> Can some comment this thread? The problem was with the entity resolver, which points to the w3c.org web site. The access to the reference DTDs on this site has been restricted for application use. The solution was to implement my own entity resolver. Related: http://forums.sun.com/thread.jspa?threadID=515055 http://stackoverflow.com/questions/1016286/org-apache-xerces-jaxp-saxparserfactoryimpl-not-found-when-importing-gears-api-in http://java.itags.org/java-desktop/4839/

    Read the article

  • Jquery UI modal dialogs

    - by Anonymous user
    Hi All. I have a problem with Jquery UI modal dialogs. I have modal dialog (dialogA), which can create another modal dialog (dialogB). After the second creation and closure of the dialogB the overlay of dialogA disappear. Here is my code: <!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><link type="text/css" rel="Stylesheet" href="ui-lightness/jquery-ui-1.8.custom.css" /> <script type="text/javascript" src="jquery-1.4.2.min.js"></script> <script type="text/javascript" src="jquery-ui-1.8.custom.min.js"></script> <script type="text/javascript"> function createDialog(dialogId) { $('#' + dialogId).dialog({ autoOpen: true, modal: true, buttons: { 'close': function() { $(this).dialog('close'); }, 'create': function() { var newDialogId = dialogId + '1'; $('body').append('<div id="' + newDialogId + '">' + newDialogId + '</div>'); createDialog(newDialogId); } }, close: function() { $(this).dialog('destroy'); $(this).remove(); } }); } $(document).ready(function() { $('#button1').click(function() { var dialogId = 'dialog'; $('body').append('<div id="' + dialogId + '">' + dialogId + '</div>'); createDialog(dialogId); }); }); </script> </head> <body> <button id="button1">Create dialog</button> </body> </html> Thanks

    Read the article

  • Using HTML5 on iPhone - cannot pause

    - by Ariel
    Hey guys, I was wondering whether anyone has tried to use the new tag that comes with HTML5 on the iPhone. Specifically, I didn't manage to make the pause() command to work. Below is a portion of the page. As you can see, I'm trying to pause the video 10sec after it started. It works on Safari on a Mac btw. Has anyone managed to make this work? <head> <javascript language="JavaScript"> function timeUpdate() { var myVideo = document.getElementsByTagName('video')[0]; var time = myVideo.currentTime; if (time > 10) { myVideo.pause(); } } function addListeners() { var myVideo = document.getElementsByTagName('video')[0]; myVideo.addEventListener('timeupdate',timeUpdate,false); } </script> </head> <body onload="addListeners()"> <video controls src="resources/bb_poor_cinderella_512kb.mp4" poster="resources/background.png"> Video tag not supported! </video> </body> Thanks, Ariel

    Read the article

  • Show hide DIVs : jQuery

    - by Muhammad Sajid
    Hi, I have two links & I want to show / hide them one at a time, my code is : <!DOCTYPE html> <html> <head> <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> // we will add our javascript code here $(document).ready(function() { $(function(){ $('#link').click(function(){ $('#colorDiv').slideToggle('slow'); return false; }); }); }); </script> <meta charset=utf-8 /> <title>JS Bin</title> <!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <style> #dv { width:100px; height:100px; border:1px solid; } </style> </head> <body> <table cellspacing="2"> <tr><td><a href="#" id="link">Color</a></td><td><a href="#" id="link">Car</a></td></tr> <tr><td><div id="colorDiv">Red</div></td><td><div id="carDiv">PRADO</div></td></tr> </table> </body> </html> by default first div should me shown. hanks.

    Read the article

  • jQuery UI datepicker will not display - full code included

    - by Bill Brasky
    I am having trouble displaying the jQuery datepicker as shown here: http://jqueryui.com/demos/datepicker/ I believe I downloaded all of the proper files, but to be certain, I started from scratch and ripped the demo site. Not all of it, but what I believed to be the important parts. The result is no datepicker to be shown and no javascript errors. Here is my full code sample: <!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> <link rel="stylesheet" href="http://static.jquery.com/ui/css/base2.css" type="text/css" media="all" /> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css" type="text/css" media="all" /> <link rel="stylesheet" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css" type="text/css" media="all" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script> <script type="text/javascript" charset="utf-8"> jQuery(function(){ jQuery("#datepicker").datepicker(); }); </script> </head> <body> <input type="text" id="datepicker" class="hasDatepicker" /> </body> </html> Any help would be very much appreciated. Thanks!

    Read the article

  • How can I optimize this or is there a better way to do it?(HTML Syntax Highlighter)

    - by Tanner
    Hello every one, I have made a HTML syntax highlighter in C# and it works great, but there's one problem. First off It runs pretty fast because it syntax highlights line by line, but when I paste more than one line of code or open a file I have to highlight the whole file which can take up to a minute for a file with only 150 lines of code. I tried just highlighting visible lines in the richtextbox but then when I try to scroll I can't it to highlight the new visible text. Here is my code:(note: I need to use regex so I can get the stuff in between < & characters) Highlight Whole File: public void AllMarkup() { int selectionstart = richTextBox1.SelectionStart; Regex rex = new Regex("<html>|</html>|<head.*?>|</head>|<body.*?>|</body>|<div.*?>|</div>|<span.*?>|</span>|<title.*?>|</title>|<style.*?>|</style>|<script.*?>|</script>|<link.*?/>|<meta.*?/>|<base.*?/>|<center.*?>|</center>|<a.*?>|</a>"); foreach (Match m in rex.Matches(richTextBox1.Text)) { richTextBox1.Select(m.Index, m.Value.Length); richTextBox1.SelectionColor = Color.Blue; richTextBox1.Select(selectionstart, -1); richTextBox1.SelectionColor = Color.Black; } richTextBox1.SelectionStart = selectionstart; } private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { try { LockWindowUpdate(richTextBox1.Handle);//Stops text from flashing flashing richTextBox1.Paste(); AllMarkup(); }finally { LockWindowUpdate(IntPtr.Zero); } } I want to know if there's a better way to highlight this and make it faster or if someone can help me make it highlight only the visible text. Please help. :) Thanks, Tanner.

    Read the article

  • Help with my PHP template class

    - by blerh
    I want to separate the output of HTML from my program code in my projects, so I wrote a very simple database class. <?php class Template { private $template; function load($filePath) { if(!$this->template = file_get_contents($filePath)) $this->error('Error: Failed to open <strong>' . $filePath . '</strong>'); } function replace($var, $content) { $this->template = str_replace("{$var}", $content, $this->template); } function display() { echo $this->template; } function error($errorMessage) { die('die() by template class: <strong>' . $errorMessage . '</strong>'); } } ?> The thing I need help with is the display() method. Say for example I use this code: $tplObj = new Template(); $tplObj->load('index.php'); $tplObj->replace('{TITLE}', 'Homepage'); $tplObj->display(); And the index.php file is this: <html> <head> <title>{TITLE}</title> </head> <body> <h1>{TITLE}</h1> <?php if($something) { echo '$something is true'; } else { echo '$something is false'; } ?> </body> </html> I'm just wondering if the PHP code in there would be run? Or would it just be sent to the browser as plaintext? I was using eval() in my template class but I hate that function :P Thanks.

    Read the article

  • Scope of This JavaScript Variable

    - by dkris
    I have a question and an issue wrt the code below: My question is what is the scope of the variable loaded here. The reason why i ask this is the onload="if(loaded==1)inittextarea() code is working fine on Firefox and not IE8. Why is this happening? Is there something specific i need to do here? Or is it not a valid practice? <html> <head> <title>Some Page</title> <link rel="stylesheet" href="../css/default.css" type="text/css"> <script type="text/javascript"> var loaded = 0; /*Point of interest*/ function jsLoaded() { loaded =1; } </script> <script type="text/javascript"> function inittextarea() { alert("test") tinyMCE.init({ elements : "content", theme : "advanced", readonly : true, mode : "exact", theme : "advanced", readonly : true, setup : function(ed) { ed.onInit.add(function() { tinyMCE.activeEditor.execCommand("mceToggleVisualAid"); }); } }); } </script> <script src="../js/tiny_mce/tiny_mce.js" onload="jsLoaded()" type="text/javascript"></script> </head> <body onload="if(loaded==1)inittextarea()"><!--Works on Firefox only--> *Usual stuff* </body></html> Any pointers please?

    Read the article

  • After Adding "readonly" attribute on text box not able to remove it in one event

    - by Sreedhar K
    Steps to repro USE Internet Explorer Check unlimited check box Click on text box (It will remove tick/check from check box) Try to enter text in text box We cannot enter in the text box 4. Click again on the text box. Now we will be able to enter text in the text box We tried by 1. Making attribute readOnly to flase i.e. $('#myinput').attr('readOnly', false); 2. Calling $('#myinput').click(); Below is the HTML code <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Make input read only</title> <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.4.min.js"></script> </head> <body> <input id="myinput" type="text" /> <input id="mycheck" type="checkbox" /> <script type="text/javascript"> /*oncheck box click*/ $('#mycheck').click(function () { if ($(this).attr('checked')) { $('#myinput').attr('readOnly', 'readOnly'); } else { $('#myinput').removeAttr('readOnly'); /* also tried * $('#myinput').attr('readOnly', false); * $('#myinput').attr('readOnly', ''); */ } }); /*on text box click*/ $('#myinput').click(function () { $('#mycheck').removeAttr('checked'); $('#myinput').removeAttr('readOnly'); /* also tried * $('#myinput').attr('readOnly', false); * $('#myinput').attr('readOnly', ''); */ }); </script> </body> </html> Live copy

    Read the article

  • called function A(args) calls a function B() which then calls a function A(args), How to do that?

    - by Ken
    See example: <!DOCTYPE html> <html> <head> <title>language</title> <script type="text/javascript" src="http://www.google.com/jsapi"> </script> </head> <body> <div id="language"></div> <script type="text/javascript"> var loaded = false; function load_api() { google.load("language", "1", { "nocss": true, "callback": function() { loaded = true; callback_to_caller(with_caller_agruments); // how to call a function (with the same arguments) which called load_api() ??? // case 1 should be: detect_language('testing'); // case 2 should be: translate('some text'); } }); } function detect_language(text) { if (!loaded) { load_api(); } else { // let's continue... believe that google.language is loaded & ready to use google.language.detect(text, function(result) { if (!result.error && result.language) { document.getElementById('language').innerHTML = result.language; } }); } } function translate(text) { if (!loaded) { load_api(); } else { // let's continue... } } detect_language('testing'); // case 1 translate('some text'); // case 2 </script> </body> </html>

    Read the article

  • How to include frameset under CGI.pm

    - by neversaint
    I want to have a cgi-script that does two things. Take the input from a form. Generate results base on the input values on a frame. Primarily I want the frame exist only after the results is generated/printed. Below is the simplified code of what I want to do. But somehow it doesn't work. What's the right way to do it? #!/usr/local/bin/perl use CGI ':standard'; print header; print start_html('A Simple Example'), h1('A Simple Example'), start_form, "What's your name? ",textfield('name'), p, "What's the combination?", p, checkbox_group(-name=>'words', -values=>['eenie','meenie','minie','moe'], -defaults=>['eenie','minie']), p, "What's your favorite color? ", popup_menu(-name=>'color', -values=>['red','green','blue','chartreuse']), p, submit, end_form, hr; if (param()) { # begin create the frame print <<EOF; <html><head><title>$TITLE</title></head> <frameset rows="10,90"> <frame src="$script_name/query" name="query"> <frame src="$script_name/response" name="response"> </frameset> EOF # Finish creating frame print "Your name is: ",em(param('name')), p, "The keywords are: ",em(join(", ",param('words'))), p, "Your favorite color is: ",em(param('color')), hr; } print end_html;

    Read the article

  • Trying to modify the text of a document onkeydown is inserting text incorrectly.

    - by Benny
    I have the following html: <html> <head> <script> function myKeyDown() { var myDiv = document.getElementById('myDiv'); myDiv.innerHTML = myDiv.innerHTML.replace(/(@[a-z0-9_]+)/gi, '<strong>$1</strong>'); } function init() { document.addEventListener('keydown', myKeyDown, false); document.designMode = "on"; } window.onload = init; </script> </head> <body> <div id="myDiv"> This is my variable name: @varname. If I type here things go wrong... </div> </body> </html> My goal is to do a kind of syntax highlighting on edit, to highlight variable names that begin with an @ symbol. However, when I edit the document's body, the function runs but the cursor is automatically shifted to the beginning of the body before the keystroke is performed. My hypothesis is that the keypress event is trying to insert the new character at a specified index, but when I run the replace function the indices get messed up so it defaults the character insertion point to the beginning. I'm using Firefox to test by the way. Any help would be appreciated. Thanks, B.J.

    Read the article

  • unexpected margin with very simple html

    - by Serhat Özgel
    I have a very simple html. The red div is inside the blue div and has a 10 px top margin. On non-ie browsers, the blue box is 10 px apart from the top of viewport and the red div is at the very top of the blue div. What I expect is the ie behavior: red div must be 10 px apart from the top of the blue div. Why does non-ie browsers render like this? (I suppose the wrong behavior is the IE's but why?) And, what is the correct way to do this? <html> <head> <style> body { margin:0; padding:0; } .outer { background-color: #00f; height: 50px; } .inner { height: 20px; width: 20px; background-color: #f00; margin: 10px 0 0 10px; } </style> </head> <body> <div class="outer"> <div class="inner"> </div> </div> </body> </html>

    Read the article

  • Why won't my styles show in a Dynamics CRM 4 IFRAME?

    - by Dan Crowther
    I have created a web page (ASP.NET) that includes a stylesheet to mimic Dynamics CRM styles. This is to be used in a CRM IFRAME (within a form). The stylesheet is referenced as follows: <head id="Head1" runat="server"> <link href="Styles.css" rel="stylesheet" type="text/css" /> </head> When I load the page in Visual Studio, all is well. When I load it in CRM, none of the styles are shown and no images are displayed. If I browse directly to the image, I get a 404 error. However, the pages function correctly. I have set read permissions for "Everyone" on the server to see if that was causing a problem but it didn't help. I also tried putting a plain HTML page in the folder and that won't load either - again a 404. The page is installed in the ISV folder ..../isv/MyProject. Can anyone help? EDIT This is on a multi-tenancy system. On my test company (testcompany) if I browse to http://crm/testcompany/isv/MyProject/MyPage.aspx, the page is loaded (without styles and images). If I browse to http://crm/testcompany/isv/MyProject/TestImage.gif, the image is not shown. If I browse to http://crm/isv/MyProject/TestImage.gif, the image is shown. Does this suggest a problem with the server setup and the way CRM messes around with virtual directories?

    Read the article

  • Absolutely positioned div on right causing scrollbar when the left doesn't

    - by Michael Snyder
    I'm trying to "flank" a centered div with some design elements that are absolutely positioned outside the main div's width. I'm getting a scroll bar due to the element on the right, but not the element on the left (IE6/7/8, Chrome, Firefox). How can I get rid of that horizontal scrollbar? <html> <head> <style type="text/css"> html, body { height: 100%; width: 100%; margin: 0; } body { text-align: center; } .wrapper { margin: 0 auto; position: relative; width: 960px; z-index: 0; } .main { background: #900; height: 700px; } .right, .left { position: absolute; height: 100px; width: 100px; } .right { background: #090; top: 0px; left: 960px; z-index: 1; } .left { background: #009; top: 0px; left: -100px; z-index: 1; } </style> </head> <body> <div class="wrapper"> <div class="main"></div> <div class="left"></div> <div class="right"></div> </div> </body> </html>

    Read the article

  • Table cell doesn't obey vertical-align CSS declaration when it contains a floated element

    - by mikez302
    I am trying to create a table, where each cell contains a big floated h1 on the left side, and a larger amount of small text to the right of the big text, vertically centered. However, the small text is showing up at the top of each cell, despite that it has a "vertical-align: middle" declaration. When I remove the big floated element, everything looks fine. I tested it in recent versions of IE, Firefox, and Safari, and this happened in every case. Why is this happening? Does anyone know of a way around it? Here is an example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'> <title>vertical-align test</title> <style type="text/css"> td { border: solid black 1px; vertical-align: middle; font-size: 12px} h1 { font-size: 40px; float: left} </style> </head> <body> <table> <tr> <td><h1>1</h1>The quick brown fox jumps over the lazy dog.</td> <td>The quick brown fox jumps over the lazy dog.</td> </tr> </table> </body></html> Notice that the small text in the first cell is at the top for some reason, but the text in the 2nd cell is vertically centered.

    Read the article

  • Netbeans (PHP) catching syntax error on xml declaration

    - by Mike Valeriano
    Hello. I've just installed and configured Netbeans to work with PHP (including xdebug), and almost everything is working as intended, except that I've been getting "errors" in the IDE after I edited the default webpage template to comply with xhtml 1.1. The template is this: <?xml version="1.0" encoding="${project.encoding}" ?> <!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=${project.encoding}" /> <title></title> </head> <body> </body> </html> These are the errors I receive (I can't post images yet). Page is created OK, character encoding is inherited from project's settings as expected. It's probably something to do with the xml declaration on top of the document, but I don't really know how to "tune" Netbeans to ignore it and not show the 3 errors on every page I create. The warning is there because NB does not recognize the xhtml 1.1 DTD, so it falls back to html 4.01, which does not support the xmlns attribute in the html tag - and that's the only thing I could find searching around. It will be fixed in the next version, so I'm not worried about it. I know there's nothing wrong with the markup, but there's probably something I'm missing in NB configuration, and I would like to get rid of those messages because they pretty much take all the space I reserve for errors/warnings/tasks. So is there any way I can either make NB recognize this xml declaration or make it ignore these specific "errors"? Thanks.

    Read the article

  • What's the scope of a Javascript variable declared in a for() loop?

    - by Dylan Beattie
    Check out the following snippet of HTML/Javascript code: <html> <head> <script type="text/javascript"> var alerts = []; for(var i = 0; i < 3; i++) { alerts.push(function() { document.write(i + ', '); }); } for (var j = 0; j < 3; j++) { (alerts[j])(); } for (var i = 0; i < 3; i++) { (alerts[i])(); } </script> </head><body></body></html> This outputs: 3, 3, 3, 0, 1, 2 which isn't what I was expecting - I was expecting the output 0, 1, 2, 0, 1, 2, I (incorrectly) assumed that the anonymous function being pushed into the array would behave as a closure, capturing the value of i that's assigned when the function is created - but it actually appears that i is behaving as a global variable. Can anyone explain what's happening to the scope of i in this code example, and why the anonymous function isn't capturing its value?

    Read the article

  • Ajax/jQuery problem

    - by Lucho
    Hi, I'm rookie when it comes to Ajax and jQuery and needs some help... The following url produces an xml-file that I want to use on my page: http://ws.spotify.com/search/1/track?q=foo When I use firebug it seems like nothing comes back. What have I done wrong? This is what my code looks like: <!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"> <head> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $.ajax({ url: 'http://ws.spotify.com/search/1/track?q=foo', type: 'GET', contentType: "application/xml; charset=utf-8", error: function(){ alert('Error loading XML document'); }, success: function(xml){ alert("success"); $(xml).appendTo("#result"); } }); }); </script> </head> <body> <div id="result"> </div> </body> </html>

    Read the article

  • navigateToURL with GET parameters in local SWF

    - by Michael Brewer-Davis
    I'm running a Flex application locally (local-with-filesystem or local-trusted), and I'm trying to call navigateToURL to a local page using GET parameters. Flash Player seems to be ignoring the parameters when opening the local page, though. I've been scouring the Flash security pages to find a documented prohibition for this, but haven't found anything. Pointers? How would you work around this issue? My Flex app: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ private function onClick(event:MouseEvent):void { var request:URLRequest = new URLRequest("target.html"); request.data = new URLVariables(); request.data.text = "stackoverflow.com"; navigateToURL(request); } ]]> </mx:Script> <mx:Button label="Go" click="onClick(event)" /> </mx:Application> And my target.html: <html> <head> <script language="JavaScript"> <!-- function showURL() { alert(window.location.href); } //--> </script> </head> <body onload="showURL()" /> </html>

    Read the article

  • GRID is not properly rendered in ExtJS 4 by using Store

    - by user548543
    Here is the Src code for HTML file <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4 /strict.dtd"> <html> <head> <title>MVC Architecture</title> <link rel="stylesheet" type="text/css" href="/bh/extjs/resources/css/ext-all.css" /> <script type="text/javascript" src="extjs/ext-debug.js"></script> <script type="text/javascript" src="Main.js"></script> </head> <body> </body> </html> File path: /bh/Main.js [Main File] Ext.require('Ext.container.Viewport'); Ext.application({ name: 'App', appFolder: 'app', controllers: ['UserController'], launch: function() { Ext.create('Ext.container.Viewport', { layout: 'border', items: [ { xtype: 'userList' } ] }); } }); File path: /app/controller/UserController.js [Controller] Ext.define('App.controller.UserController',{ extend: 'Ext.app.Controller', stores: ['UserStore'], models:['UserModel'], views:['user.UserList'], init: function() { this.getUserStoreStore().load(); } }); File path: /app/store/UserStore.js Ext.define('App.store.UserStore', { extend: 'Ext.data.Store', model: 'App.model.UserModel', proxy: { type: 'ajax', url: 'app/data/contact.json' } }); File path: /app/model/UserModel.js [Model] Ext.define('App.model.UserModel',{ extends:'Ext.data.Model', fields:[ {name: 'name', type: 'string'}, {name: 'age', type: 'string'}, {name: 'phone', type: 'string'}, {name: 'email', type: 'string'} ] }); File path: /app/view/UserList.js [View] Ext.define('App.view.user.UserList' ,{ extend: 'Ext.grid.Panel', alias:'widget.userList', title:'Contacts', region:'center', resizable:true, initComponent: function() { this.store = 'UserStore'; this.columns = [ {text: 'Name',flex:1,sortable: true,dataIndex: 'name'}, {text: 'Age',flex:1,sortable: true,dataIndex: 'age'}, {text: 'Phone',flex:1,sortable: true,dataIndex: 'phone'}, {text: 'Email',flex:1,sortable: true,dataIndex: 'email'} ]; this.callParent(arguments); } }); In fire bug it shows the JSON response as follows: [{ "name": "Aswini", "age": "32", "phone": "555-555-5555", "email": "[email protected]" }] Why the Data has not been displayed although I have a valid json response. Please help!!!

    Read the article

  • ASP.NET MVC static-asset aides/practices

    - by shannon
    I want to keep assets that are only used by one view in a view-specific folder, so my Search.aspx properly finds images/*.jpg, and helps me maintain my convention: ~/Areas/Candidate/Views/Job/Search.aspx -> ~/Assets/Candidate/Job/Search/images/*.jpg Perhaps with the ability to easily reference controller- or area-common assets manually or automatically: ~/Assets/Candidate/Job/images/*.jpg ~/Assets/Candidate/images/*.jpg If you wonder why I'm doing this, then speak up; I'm probably missing something. But here's why: I don't want stale static assets sitting in my ASP.NET MVC projects, which I expect to be an automatic outcome of the ~/Assets/Images folder: i.e. As a shared asset loses its last reference-count, who knows to delete it, especially with it being so difficult to trace content link validity in MVC projects? How do you, personally, do this? I can imagine, for example: Implement HtmlHelper extension methods for URL-generation. Extending ViewPage and ViewMasterPage with URL-generation methods. Implementing an inbound request filter to search related folders for static assets. and, are there good libraries out there for this? For example, something that also automatically appends timestamps for .JS and .CSS files, writes the / tags for me, and maybe even that allows me to inject includes in the head section from outside head code?

    Read the article

  • CSS :hover not working

    - by Babiker
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <style type='text/css'> #body{ margin:0px; } #headerDiv{ background-color:#e0e2eb; } .header_innerHeaderDivs{ border:solid 1px gray; display:inline; font:normal 11px tahoma; color:black; } .header_innerHeaderDivs:hover{ padding:4px; } </style> </head> <body id='body'> <div id='headerDiv'> <div class='header_innerHeaderDivs'>Comapny</div> <div class='header_innerHeaderDivs'>Edit</div> <div class='header_innerHeaderDivs'>Inventory</div> <div class='header_innerHeaderDivs'>Logout</div> </div> </body> </html>

    Read the article

< Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >