Search Results

Search found 28881 results on 1156 pages for 'javascript is future'.

Page 64/1156 | < Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >

  • Javascript: Can't control parent of descendant nodes.

    - by .phjasper
    I'm creating elements (level 1) dynamically which in turn create elements (level 2) themselves. However, the children of level 2 elements have "body" as their parent. In the HTML code below, the content if spotAd2 is created by my function createNode(). It's a Google Ad Sense tag. However, the Google Ad Sense tag create elements that went directly under "body". I need them to by under spotAd2. function createNode( t, // type. tn, // if type is element, tag name. a, // if type is element, attributes. v, // node value or text content p, // parent f ) // whether to make dist the first child or not. { n = null; switch( t ) { case "element": n = document.createElement( tn ); if( a ) { for( k in a ) { n.setAttribute( k, a[ k ] ); } } break; case "text": case "cdata_section": case "comment": n = document.createTextNode(v); break; } if ( p ) { if( f ) { p.insertBefore( n, p.firstChild ); } else { p.appendChild( n ); } } return n; } spotAd2 = document.getElementById("spotAd2"); n1 = createNode("element", "div", {"id":"tnDiv1"}, "\n" , null, true); n2 = createNode("element", "script", {"type":"text\/javascript"}, "\n" , n1, false); n3 = createNode("comment", "", null, "\n" + "google_ad_client = \"pub-0321943928525350\";\n" + "/* 728x90 (main top) */\n" + "google_ad_slot = \"2783893649\";\n" + "google_ad_width = 728;\n" + "google_ad_height = 90;\n" + "//\n" , n2, false); n4 = createNode("element", "script", {"type":"text\/javascript","src":"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js"}, "\n" , n1, false); --- Result: <body> <table cellspacing="2" cellpadding="2" border="1"> <tbody><tr> <td>Oel ngati kemeie</td> <td>Kamakto niwin</td> </tr> <tr> <td>The ad:</td> <td> <div id="spotAd2"> <!-- Created by createNode() --> <div id="tnDiv1"> <script type="text/javascript"> google_ad_client = "pub-0321943928525350"; /* 728x90 (main top) */ google_ad_slot = "2783893649"; google_ad_width = 728; google_ad_height = 90; </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> </div> <!-- Created by createNode() --> </div> </td> </tr> <tr> <td>txopu ra'a tsi, tsamsiyu</td> <td>teyrakup skxawng</td> </tr> </tbody></table> <!-- Created by adsense tag, need these to be under tnDiv1 --> <script src="http://pagead2.googlesyndication.com/pagead/expansion_embed.js"></script> <script src="http://googleads.g.doubleclick.net/pagead/test_domain.js"></script> <script>google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);</script> <ins style="border: medium none ; margin: 0pt; padding: 0pt; display: inline-table; height: 90px; position: relative; visibility: visible; width: 728px;"> <ins style="border: medium none ; margin: 0pt; padding: 0pt; display: block; height: 90px; position: relative; visibility: visible; width: 728px;"> <iframe width="728" scrolling="no" height="90" frameborder="0" vspace="0" style="left: 0pt; position: absolute; top: 0pt;" src="http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-0321943928525350&amp;output=html&amp;h=90&amp;slotname=2783893649&amp;w=728&amp;lmt=1273708979&amp;flash=10.0.45&amp;url=http%3A%2F%2Fkenshin.katanatechworks.com%2Ftest%2FadsBrowserSide.php&amp;dt=1273708980294&amp;shv=r20100422&amp;correlator=1273708980298&amp;frm=0&amp;ga_vid=695691836.1273708981&amp;ga_sid=1273708981&amp;ga_hid=1961182006&amp;ga_fc=0&amp;u_tz=480&amp;u_his=2&amp;u_java=1&amp;u_h=1080&amp;u_w=1920&amp;u_ah=1052&amp;u_aw=1920&amp;u_cd=24&amp;u_nplug=5&amp;u_nmime=38&amp;biw=1394&amp;bih=324&amp;fu=0&amp;ifi=1&amp;dtd=955&amp;xpc=Jl67G4xiq6&amp;p=http%3A//kenshin.katanatechworks.com" name="google_ads_frame" marginwidth="0" marginheight="0" id="google_ads_frame1" hspace="0" allowtransparency="true"> </iframe> </ins> </ins> <!-- Created by adsense tag, need these to be under tnDiv1 --> </body>

    Read the article

  • how to attach window.close to cntrl+w keypress event in a xul window?

    - by Erik Vold
    I have a XUL window, and I want the cntrl+w hotkey to close the window, but when I attach: window.addEventListener("keypress", function(ev) { GM_log("onkeypress handler: \n" + "keyCode property: " + ev.keyCode + "\n" + "which property: " + ev.which + "\n" + "charCode property: " + ev.charCode + "\n" + "Character Key Pressed: " + String.fromCharCode(ev.charCode) + "\n"); }, true); to the page, it treats pressing 'w' and 'cntrl+w' the same, charCode 119.. how can I determine that cntrl+w was pressed so that I may window.close() ?

    Read the article

  • about onmouseout event.

    - by lazyanno
    as follow codes: <div id="outerBox" style="border:1px solid red;width:300;height:300" onmouseout="alert('out')"> <div id="innerBox" style="border:1px solid blue;width:50;height:50">inner</div> </div> why when i move mouse on the "innerBox", it was trigger alert('out') ? i want mouse out "outerBox" trigger alert('out') only, mouse on "innerBox" don't trigger alert. hot to do this? thanks all :)

    Read the article

  • How to use soap in javascript

    - by fresher
    Hi guys, I am trying to use SOAP in javascript but i am not getting how to start it. Here is the code sample i write in PHP and it works fine. I want to write this code in Javascript. In following code i call one api from a www.example.com and for calling certain api we require to pass some parameters. $soapClient = new SoapClient("https://www.example.com/abc.aspx?WSDL"); // Prepare SoapHeader parameters $param_sh = array( ); $header = new SoapHeader('http://somesite.com/action/', 'user_credential', $param_sh); // Prepare Soap Client $soapClient->__setSoapHeaders(array($header)); // Setup the RemoteFunction parameters $param = array( "pwd" => "password", "id" => "name" ); // Call RemoteFunction () $contents = $soapClient->__call("name_of_api",array($param)); print_r($contents); Thanx in advance!!!

    Read the article

  • how to fix Facebook JSDK that sometimes loads twice, once, or doesnt load at all?

    - by user1108310
    Im using facebook javaSDK for my website and I have a weird problem. When I load the website with "internet explorer" it always runs fine. When I load the website with firefox it always loads TWICE, and when I use chrome the JSDK sometimes loads once and sometimes not loads at all , giving me the error "Uncaught ReferenceError: FB is not defined ". I tried using asynchronous loading for the SDK but still the same problem. btw I have firebug on firefox, could that be the reason the JSDK loads twice? Thanks

    Read the article

  • Backbone.js Adding Model to Collection Issue

    - by jtmgdevelopment
    I am building a test application in Backbone.js (my first app using Backbone). The app goes like this: Load Data from server "Plans" Build list of plans and show to screen There is a button to add a new plan Once new plan is added, add to collection ( do not save to server as of now ) redirect to index page and show the new collection ( includes the plan you just added) My issue is with item 5. When I save a plan, I add the model to the collection then redirect to the initial view. At this point, I fetch data from the server. When I fetch data from the server, this overwrites my collection and my added model is gone. How can I prevent this from happening? I have found a way to do this but it is definitely not the correct way at all. Below you will find my code examples for this. Thanks for the help. PlansListView View: var PlansListView = Backbone.View.extend({ tagName : 'ul', initialize : function() { _.bindAll( this, 'render', 'close' ); //reset the view if the collection is reset this.collection.bind( 'reset', this.render , this ); }, render : function() { _.each( this.collection.models, function( plan ){ $( this.el ).append( new PlansListItemView({ model: plan }).render().el ); }, this ); return this; }, close : function() { $( this.el ).unbind(); $( this.el ).remove(); } });//end NewPlanView Save Method var NewPlanView = Backbone.View.extend({ tagName : 'section', template : _.template( $( '#plan-form-template' ).html() ), events : { 'click button.save' : 'savePlan', 'click button.cancel' : 'cancel' }, intialize: function() { _.bindAll( this, 'render', 'save', 'cancel' ); }, render : function() { $( '#container' ).append( $( this.el ).html(this.template( this.model.toJSON() )) ); return this; }, savePlan : function( event ) { this.model.set({ name : 'bad plan', date : 'friday', desc : 'blah', id : Math.floor(Math.random()*11), total_stops : '2' }); this.collection.add( this.model ); app.navigate('', true ); event.preventDefault(); }, cancel : function(){} }); Router (default method): index : function() { this.container.empty(); var self = this; //This is a hack to get this to work //on default page load fetch all plans from the server //if the page has loaded ( this.plans is defined) set the updated plans collection to the view //There has to be a better way!! if( ! this.plans ) { this.plans = new Plans(); this.plans.fetch({ success: function() { self.plansListView = new PlansListView({ collection : self.plans }); $( '#container' ).append( self.plansListView.render().el ); if( self.requestedID ) self.planDetails( self.requestedID ); } }); } else { this.plansListView = new PlansListView({ collection : this.plans }); $( '#container' ).append( self.plansListView.render().el ); if( this.requestedID ) self.planDetails( this.requestedID ); } }, New Plan Route: newPlan : function() { var plan = new Plan({name: 'Cool Plan', date: 'Monday', desc: 'This is a great app'}); this.newPlan = new NewPlanView({ model : plan, collection: this.plans }); this.newPlan.render(); } FULL CODE ( function( $ ){ var Plan = Backbone.Model.extend({ defaults: { name : '', date : '', desc : '' } }); var Plans = Backbone.Collection.extend({ model : Plan, url : '/data/' }); $( document ).ready(function( e ){ var PlansListView = Backbone.View.extend({ tagName : 'ul', initialize : function() { _.bindAll( this, 'render', 'close' ); //reset the view if the collection is reset this.collection.bind( 'reset', this.render , this ); }, render : function() { _.each( this.collection.models, function( plan ){ $( this.el ).append( new PlansListItemView({ model: plan }).render().el ); }, this ); return this; }, close : function() { $( this.el ).unbind(); $( this.el ).remove(); } });//end var PlansListItemView = Backbone.View.extend({ tagName : 'li', template : _.template( $( '#list-item-template' ).html() ), events :{ 'click a' : 'listInfo' }, render : function() { $( this.el ).html( this.template( this.model.toJSON() ) ); return this; }, listInfo : function( event ) { } });//end var PlanView = Backbone.View.extend({ tagName : 'section', events : { 'click button.add-plan' : 'newPlan' }, template: _.template( $( '#plan-template' ).html() ), initialize: function() { _.bindAll( this, 'render', 'close', 'newPlan' ); }, render : function() { $( '#container' ).append( $( this.el ).html( this.template( this.model.toJSON() ) ) ); return this; }, newPlan : function( event ) { app.navigate( 'newplan', true ); }, close : function() { $( this.el ).unbind(); $( this.el ).remove(); } });//end var NewPlanView = Backbone.View.extend({ tagName : 'section', template : _.template( $( '#plan-form-template' ).html() ), events : { 'click button.save' : 'savePlan', 'click button.cancel' : 'cancel' }, intialize: function() { _.bindAll( this, 'render', 'save', 'cancel' ); }, render : function() { $( '#container' ).append( $( this.el ).html(this.template( this.model.toJSON() )) ); return this; }, savePlan : function( event ) { this.model.set({ name : 'bad plan', date : 'friday', desc : 'blah', id : Math.floor(Math.random()*11), total_stops : '2' }); this.collection.add( this.model ); app.navigate('', true ); event.preventDefault(); }, cancel : function(){} }); var AppRouter = Backbone.Router.extend({ container : $( '#container' ), routes : { '' : 'index', 'viewplan/:id' : 'planDetails', 'newplan' : 'newPlan' }, initialize: function(){ }, index : function() { this.container.empty(); var self = this; //This is a hack to get this to work //on default page load fetch all plans from the server //if the page has loaded ( this.plans is defined) set the updated plans collection to the view //There has to be a better way!! if( ! this.plans ) { this.plans = new Plans(); this.plans.fetch({ success: function() { self.plansListView = new PlansListView({ collection : self.plans }); $( '#container' ).append( self.plansListView.render().el ); if( self.requestedID ) self.planDetails( self.requestedID ); } }); } else { this.plansListView = new PlansListView({ collection : this.plans }); $( '#container' ).append( self.plansListView.render().el ); if( this.requestedID ) self.planDetails( this.requestedID ); } }, planDetails : function( id ) { if( this.plans ) { this.plansListView.close(); this.plan = this.plans.get( id ); if( this.planView ) this.planView.close(); this.planView = new PlanView({ model : this.plan }); this.planView.render(); } else{ this.requestedID = id; this.index(); } if( ! this.plans ) this.index(); }, newPlan : function() { var plan = new Plan({name: 'Cool Plan', date: 'Monday', desc: 'This is a great app'}); this.newPlan = new NewPlanView({ model : plan, collection: this.plans }); this.newPlan.render(); } }); var app = new AppRouter(); Backbone.history.start(); }); })( jQuery );

    Read the article

  • Facebook JS SDK FB.logout() doesn't terminate user session

    - by Casey Flynn
    I'm attempting to log a user out of facebook with the Facebook JS SDK, however calling: FB.logout(function(response){ console.log(response); }); returns: response.status == "connected" And only after refreshing the page does the SDK realize that the session has ended. Anyone know what could be causing this behavior? This code previously worked in my application and has recently started behaving this way. Another example using FireBug:

    Read the article

  • Javascript Problem! Not changing the css style

    - by mathew
    I have this code in JavaScript: function change() { document.getElementById("mem").className = 'gif'; } The fig and gif are like this: a.fig { background: #FFFFFF; } a.gif { background: #000099 ; } and the function is used like this <a class ="fig" id ="mem" onClick="javascript:change()" href="users" > Where the only difference between gif and fig in CSS is that they have different background colors. The problem is that the change is only noticeable in just a second and it is not permanent! Any ideas?

    Read the article

  • Strange JavaScript Regular Expression Behavior

    - by Kiwi
    I'm getting different behavior from a regular expression in JavaScript depending on whether or not I declare it using literal syntax. Using a extremely simple test HTML file: <html> <head> <script type="text/javascript"> var s = '3'; var regex1 = /\d/; var regex2 = new RegExp('\d'); alert(s.search(regex1)); // 0 (matches) alert(s.search(regex2)); // -1 (does not match) </script> </head> <body></body> </html> The regular expression declared with literal syntax (/\d/) works correctly, while the other (new RegExp('\d')) does not. Why on earth is this happening? I'm using Google Chrome 5.0.375.70 on Windows Vista Home Premium, if that's at all helpful.

    Read the article

  • [IE 7/8] Loading HTML content in via Javascript nulls my <title> tag in some instances

    - by Simon
    This is an Explorer only problem and the symptoms are: I have links that when clicked will load in HTML chunks (none of which contain html header tags) using javascript. The html chunks are placed in various <div>s around the page, perhaps 3 different places with 3 different chunks brought in via javascript. When these chunks load in the <title> tag of the page gets set to <title></title> for some unknown (to me) reason. I've used the IE developer toolbar to confirm this by inspecting the DOM tree. I have other pages that do similar things but it does not seem to be a problem there.

    Read the article

  • Firefox XUL toolbar with javascript to IE?

    - by user325377
    Hi, I have developed a Firefox toolbar in XUL, which uses javascript to manipulate the DOM. I'd like to export this to IE. I know that IE doesn't support XUL, but wonder: (1) is there an easy way to use the existing javascript code for the IE toolbar as well? (2) is there a IE installer that easily creates all necessary registry values for creating a toolbar? I'd be grateful for any help. If anyone can point me to a sample IE toolbar code, with several buttons, drop-down menus and perhaps even a search box, that'll make things much easier as well. Thanks!

    Read the article

  • Problem with HTML inside Javascript

    - by Vafello
    I am trying to implement 'time-ago' feature in my website using a JQuery timeago plugin. Unfortunately I have encountered some problems. <script type="text/javascript" charset="utf-8"> jQuery("abbr.timeago").timeago(); </script> var content = document.getElementById('div'); var html = "<abbr class=timeago title=2008-07-17T09:24:17Z></abbr>" + '<br><br>'; content.innerHTML += html <div id='div'></div This jquery plugin basically convert timestamp from the title and print it in a nice format for every abbr class=timeago. The problem is that the code above doesn't work, but if I put it within this div it works fine. I think it is maybe because this jquery plugin is applied before generating html by javascript, but I am not sure. Any ideas?

    Read the article

  • calling a method from an event handler

    - by Ayoub
    I have this code i am working on but every time i call init method I keep getting an error this.addElement is not a function is it because i can't call methods from event handlers ? function editor () { this.init = function () { $("#area").bind('click' , this.click_event ); } this.addElement = function () { console.log("adding element"); } this.click_event = function(event) { this.addElement(); console.log("click event in x : "+event.data); } }

    Read the article

  • Visual Studio confused by server code inside javascript

    - by Felix
    I ran into an annoying problem: the following code gives a warning in Visual Studio. <script type="text/javascript"> var x = <%: ViewData["param"] %>; </script> The warning is "Expected expression". Visual Studion gets confused, and all the javascript code after that is giving tons of warnings. Granted, it's all warnings, and it works perfectly fine in runtime - but it is very easy to miss real warnings among dozen of false positives. It was working the same way in VS2008, and it wasn't fixed in VS2010. Does anybody know if there is a workaround, or a patch?

    Read the article

  • Binding mousemove within mousedown function with jQuery

    - by colinjameswebb
    I am trying to bind a mousemove event to a div when the left mousebutton is down, and unbind when it is released. This code should be fairly self-explainatory. function handleMouseDown(e, sbar){ if (e.button == 0){ console.log(sbar); //firebug sbar.bind('mousemove', function(event){ handleMouseMove(event, sbar); }); } } function handleMouseUp(e, sbar){ sbar.unbind('mousemove'); } function handleMouseMove(e, sbar){ // not sure it this will work yet, but unimportant $(".position").html(e.pageX); } $(document).ready(function (){ var statusbar = $(".statusbar"); statusbar.mousedown(function(event){ handleMouseDown(event, this); }); statusbar.mouseup(function(event){ handleMouseUp(event, this); }); }); The important part of the HTML looks like this <div id="main"> <div class="statusbar"> <p class="position"></p> </div> </div> Firebug says that the bind methods are undefined on the variable sbar within handleMouseDown and handleMouseUp. The firebug console prints out <div class="statusbar"> for the line commented //firebug. I'm doing something wrong, probably when binding the mousedown and mouseup... but what?! I'm using jQuery v1.4.2, if that helps?

    Read the article

  • jquery event get array of objects

    - by Anton
    I have few nested DIV elements. For example: <div id='id1'><div id='id2'>content</div></div> I attach event to DIVs event handler using jQuery: $('div').click(function () { //some code }); There will be two events when user click on content. So there will be two simultaneous events. Is it possible to get inside event handler array of objects (DIVs) what have click event? May be it is possible using other framework but jQuery?

    Read the article

  • Google Maps API and "rightclick" events on Macs

    - by samc
    Using the Google Maps API (v3), I can create a map and handle normal click events just fine, but when I want to handle rightclick events, it doesn't work on Macs. I assume this is because a rightclick on a Mac is actually converted to a ctrl-click, but the Google Maps API MouseEvent doesn't provide information about modifier keys, so I can't check for the ctrl key. I tried adding an "capture" event listener to the document that converts the click event to a rightclick event. function convertClick(e) { if (e.ctrlKey) { e.button = 2; } } document.addEventListener("click", convertClick, true) I added an alert to verify that the condition is correct, but modifying the event in this way didn't work. So, I decided to have my event handler set a global flag that my click handler could check. If the flag is set, it means ctrl was pressed, so the click handler just invokes the rightclick handler. var ctrl; function captureCtrl(e) { ctrl = e.ctrlKey; } This approach worked great, except for one thing. The ctrl flag gets set for the click after the one that occured when ctrl was pressed. That means the event handler is be called during the bubble phase rather than the capture phase. Could explain why the event modification approach didn't work. So, my question is how can you detect "rightclick" events from Macs with the Google Maps API? I can't be the first person to want to do this. That said, when I right-click on the map on http://maps.google.com from a Windows or Linux machine, I get a popup box with options like "Directions from here...", etc. On a Mac, nothing happens. So, not even the main Google Maps page has solved this problem. ...maybe I am the first person to want to do this.

    Read the article

  • Remove Duplicates from JavaScript Array

    - by kramden88
    This seems like such a simple need but I've spent an inordinate amount of time trying to do this to no avail. I've looked at other questions on SO and I haven't found what I need. I have a very simple JavaScript array such as peoplenames = new Array("Mike","Matt","Nancy","Adam","Jenny","Nancy","Carl"); that may or may not contain duplicates and I need to simply remove the duplicates and put the unique values in a new array. That's it. I could point to all the codes that I've tried but I think it's useless because they don't work. If anyone has done this and can help me out I'd really appreciate it. JavaScript or jQuery solutions are both acceptable.

    Read the article

  • Make an element visible to the user but invisible to events

    - by Acorn
    I'm not quite sure how to describe what I'm looking to do, but I'll do my best. At the moment I have a parent <div>, with absolutely positioned child <div>s within it, and I'm tracking the mouse pointer location coordinates relative to the element your mouse is over. At the moment, when I mouse over my child <div>s, I get the mouse location relative to them, but I want the coordinates to be relative the the parent <div> even when mousing over the child elements. So I basically want the child elements to be visible, but transparent to the mousemove, so I want the mousemove to go straight through to the parent element. How would I do this? Do I maybe need to somehow make the parent <div> be in the forground but still have the child <div>s show through? or make a transparent <div> overlay just to get the mouse coordinates? Here's a link to the page I'm experimenting on: http://acorn.host22.com/mouse.html

    Read the article

  • innerHTML and event delegation

    - by Mark Gerrard
    Hello, I have a containing div that has multiple divs within which is updated every 25ms using innerHTML (for performance reasons). I have tried using event delegation to capture events but nothing I seem to do captures the click event. I think this may be due to the speed that the contents are getting updated. Any ideas would be very welcome. Thanks Mark

    Read the article

  • JavaScript OnClick Handler Not Invoking

    - by potatolicious
    I'm calling a javascript function in an inline onclick like so: <a href="#" onclick="removeAttribute('foo', 'bar');">Some Link</a> When I click on the link, though, nothing happens. I have other links (to other functions) tied to onclicks that work fine elsewhere on the same page. All links to this "removeAttribute" function fail. There are no errors in Firebug, and the onclick event handler is being invoked - but stepping into the removeAttribute function ends up, for some reason, somewhere in jQuery.js. At no point does removeAttribute ever get called. If I do: javascript:removeAttribute('foo', 'bar'); in Firefox's address bar. The function is called successfully. Anyone seen this?

    Read the article

  • Bypassing Javascript form handler

    - by Ben Aston
    We are writing an ASP.NET MVC application. By default, if the client browser has Javascript, the handler for every form on the page is set, by Javascript, to be one that sends the submission down an Ajax "pipe" (progressive enhancement). But, for one form (on a page of several), I'd like this handler to be bypassed/ignored. Is there a simple way to do this? Perhaps by overriding the handler by specifying my own onsubmit event directly in the DOM - or some other method? We use jQuery, so those libraries are available to me.

    Read the article

< Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >