Search Results

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

Page 54/1156 | < Previous Page | 50 51 52 53 54 55 56 57 58 59 60 61  | Next Page >

  • Inserting javascript with jQuery .html

    - by Andrew Appleby
    I'm experiencing an issue with a website I'm working on, where I originally believed I could simply replace $("main").html('THIS') which was originally code for a flash object, with a new and improved HTML5/Javascript version. The original code: $("#main").html('<div style="height: 100%; width: 100%; overflow: hidden;"><object width="100%" height="100%" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">\ <param value="images/uploads/'+image_id+'.swf" name="movie">\ <param value="true" name="allowFullScreen">\ <param value="#737373" name="bgcolor">\ <param value="" name="FlashVars">\ <embed width="100%" height="100%" flashvars="" bgcolor="#737373" allowfullscreen="true" src="images/uploads/'+image_id+'.swf" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">\ </object></div>\ '); }); And my (failed) attempt at inserting my new code: $("#main").html('<script type="text/javascript">pano=new pano2vrPlayer("container");skin=new pano2vrSkin(pano);pano.readConfigUrl("xml/tablet_'+image_id+'.xml");hideUrlBar();</script>'); It doesn't even work when I just put , so I know it's gotta be the javascript itself. I've looked at the solutions out there, but I can't make sense in how to properly implement them here in the most efficient way. Your help is much appreciated, thanks!

    Read the article

  • Why does my javascript file sometimes compressed while sometimes not?(IIS Gzip problem)

    - by Kevin Yang
    i enable gzip for javascript file in my iis settings, here 's the corresponding config section. <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files"> <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="10" dynamicCompressionLevel="8" /> <dynamicTypes> <add mimeType="text/*" enabled="true" /> <add mimeType="message/*" enabled="true" /> <add mimeType="application/soap+msbin1" enabled="true" /> <add mimeType="*/*" enabled="false" /> </dynamicTypes> <staticTypes> <add mimeType="text/*" enabled="true" /> <add mimeType="message/*" enabled="true" /> <add mimeType="application/javascript" enabled="true" /> <add mimeType="application/x-javascript" enabled="true" /> <add mimeType="*/*" enabled="false" /> </staticTypes> </httpCompression> currently, when i download my js file, it seems that sometimes server return the gzip one, and sometimes not. i dont know why, and how to debug that. If a file is already gzipped, it should be cached in local disk, and next time someone visit that file again, iis kernel should return the cache gzip file directly without compressing it again. Is that right?

    Read the article

  • functions with same names in javascript

    - by biju
    Hi, I tried to write a function on a js file and another function with the same name in the page.I expected an error but no error came and i got only the function from the js file to execute.How is this possible.Even if i write a function in a separate js file,everything is rendered in a single html file.Then how come it is possible <script type="text/javascript" language="javascript" src="JScript.js" /> <script language="javascript"> function Boo() { alert("Hai new"); } </script> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:Button runat=server OnClientClick="Boo();" Text="Click" /> </div> </form> </body> and in the js file function Boo() { alert("Hai"); }

    Read the article

  • Javascript: How to test JSONP on localhost

    - by hqt
    Here is the way I test JSONP: I run XAMPP, and in folder htdocs I create a javascript folder . I create json1.json file contain some data to process. After that, I run this html file locally, and it will call a function in "other machine" (in this case is localhost) Here is my code : <head> <script> function updateSales(sales) { alert('test jsonp'); // real code here } </script> </head> <body> <h1>JSONP Example</h1> <script src="http://localhost:85/javascript/json1.json?callback=updateSales"></script> </body> But when I run, nothing happen. But if change to other real json on the internet, it will work. It means change line : <script src="http://localhost:85/javascript/json1.json?callback=updateSales"></script> to line: <script src="http://gumball.wickedlysmart.com/?callback=updateSales"></script> It will work smoothly. So, I don't know how to test JSONP by using localhost, please help me. Thanks :)

    Read the article

  • Javascript error : " 'Sys' is undefined "

    - by Simon
    Hi there, I keep having an error when running my web application. The error does not cause a compilation error when on live server at least a javascript error and nothing else. But the real problem is when "debug" ... javascript error stops the compilation and I have to "Continue" three times before proceeding normally my debug. But this error occurs at every refresh the page. All this using Visual Studio. After several hours of search on google, I saw that it was a problem with the ScriptManager and Ajax. The real problem is that I do not use any Ajax on this page but the ScriptManager is on the masterpage. Worse still, on any other page on the website, that may use Ajax or not, no javascript error! Only THIS page cause this error! Any suggestion? Note that I usualy talk french so there's probably error and sorry for this! EDIT There's the 3 places were compilation stop. 1. Sys.WebForms.PageRequestManager._initialize('ctl00$ctl08', document.getElementById('aspnetForm')); 2. Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90); 3. Sys.Application.initialize();

    Read the article

  • Javascript and jQuery (Fancybox) question

    - by songdogtech
    Javascript and jQuery (Fancybox) question I'm using the Javascript function below for Twitter sharing (as well as other services; the function code is simplified to just Twitter for this question) that grabs the to-be-shared page URL and title and it is invoked in the link with onclick. That results in the Twitter share page loading in a pop up browser window, i.e.<img src="/images/twitter_16.png" onclick="share.tw()" /> In order to be consistent with other design aspects of the site, what I'd like to be able to do is have the Twitter share page open not in a standard browser window but in a Fancybox (jQuery) window. Fancybox can load an external page in an iFrame when the img or href link contains a class (in this case class="iframe" ) in the link and in the document ready function in the header. Right now, of course, when I give the iframe class to the link that also has the onclick share.tw(), I get two popups: one browser window popup with the correct Twitter share page loaded, and a Fancybox jQuery popup that shows a site 404. How can I change the function to use Fancybox to present the Twitter share page? Is that a correct way to approach it? Or is there a better way, such as implementing the share function in jQuery, too? Thanks... Javascript share function: var share = { tw:function(title,url) { this.share('http://twitter.com/home?status=##URL##+##TITLE##',title,url); }, share:function(tpl,title,url) { if(!url) url = encodeURIComponent(window.location); if(!title) title = encodeURIComponent(document.title); tpl = tpl.replace("##URL##",url); tpl = tpl.replace("##TITLE##",title); window.open(tpl,"sharewindow"+tpl.substr(6,15),"width=640,height=480"); } }; It is invoked, i.e.: <img src="/images/twitter_16.png" onclick="share.tw()" /> Fancybox function, invoked by adding class="iframe" in the img or href link $(".iframe").fancybox({ 'width' : '100%', 'height' : '100%', 'autoScale' : false, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe' });

    Read the article

  • Load more function in Javascript

    - by erastusnjuki
    EDIT: This question was initially too general, I think. So What I really need is a very good tutorial on how to implement the Load More function on Safari for iPhone just like the Twitter website(mobile.twitter.com) does. Just a wordpress plugin won't really help. But if the plugin is well explained, like if it is wptouch, home(that also has this function) that can also do. I know that it doesn't really matter that it is being displayed on a mobile device, but the point I am stressing is that if such a function is well explained, then it will be up to me to know how to customize it to suit me. I am using a javascript function to load entries that come from the database dynamically, so that content opens in the same page (like with twitter(tweets feed) and facebook(news feed)). The php/html version(That opens a page in a new tab) is echo '<a href="http://'. $_SERVER['HTTP_HOST'] .'/'.$domain_page.'?form='.$form_id.'&page='.($page+1).'">Load more entries&rsaquo; </a>'; The javascript/ajax version: <div id="call_hv<?php echo md5($_SERVER['REQUEST_URI']); ?>" class="ajax-load-more"> <img id="spinner<?php echo md5($_SERVER['REQUEST_URI']); ?>" class="spin" src="<?php bloginfo('template_directory'); ?>/images/main-ajax-loader.gif" style="display:none" alt="" /> <a class="ajax" href="javascript:$ajax_hv('#spinner<?php echo md5($_SERVER['REQUEST_URI']); ?>').fadeIn(200); $ajax_hv('#ajaxentries_hv<?php echo md5($_SERVER['REQUEST_URI']); ?>').load('form='<? echo $form_id; ?>&page=<?php echo $page+1;?>', {}, function(){ $ajax_hv('#call_hv<?php echo md5($_SERVER['REQUEST_URI']); ?>').fadeOut();})">Load more entries... </a>

    Read the article

  • Selections and radioing - JavaScript

    - by Wayne
    I have a list like this: <ul> <li id="adm-thumb" onclick="javascript:addBanner('bowling.jpg');"> <div class="adm-tick"></div> <img src="img/banners/bowling.jpg" /></li> <li id="adm-thumb" onclick="javascript:addBanner('kcc.jpg');"> <div class="adm-tick"></div> <img src="img/banners/kcc.jpg" /></li> <li id="adm-thumb" onclick="javascript:addBanner('paintballing.png');"> <div class="adm-tick"></div> <img src="img/banners/paintballing.png" /></li> </ul> <input id="bannername" type="text" /> When one item is clicked, the value inside the addBanner() will be added to the input field, however, I want one list to be selected (which is done by css to make it look like it has) when it is equal to the value of the input value. If the value is equals to the value in the addBanner value then the clicked item should have a red background. e.g. function addBanner(label) { var Field = document.getElementById('bannername'); Field.value = label; if(Field.value != label) { // I have no idea what to put here } } Something like a div button that acts like a radio button.

    Read the article

  • Positioning Javascript Tag on HTML Page

    - by user3385997
    I'm growing frustrated in positioning my javascript date in the center of my html page. Everything else is centered but the javascript date. Here's a screenshot: My HTML: <section> <a href="http://validator.w3.org/check?uri=http%3A%2F%2Fhills.ccsf.edu%2F~avu%2Fhw1.html" target="_blank"><img id="html5logo"src="images/html5_logo.png" alt="html5" height="50" width="50" /></a> <a href="http://alturl.com/9kv4o" target="_blank"><img id="csslogo" src="images/css_logo.gif" alt="css" height="50" width="50" /></a> </section> <br /> <p id="pagelastupdated">Page last updated:</p> <script type="text/javascript"> document.write(document.lastModified); </script> And here's my CSS: section { margin-top: 10px; margin-left: auto; margin-right: auto; width: 112px; } section img#html5logo { display: inline; margin-left: auto; margin-right: auto; } section img#csslogo { display: inline; margin-left: auto; margin-right: auto; } #pagelastupdated { text-align: center; } script { border: 4px solid purple; } PLEASE HELP ME!

    Read the article

  • Mouse management in JavaScript games

    - by Jakob
    Im using JavaScript, the HTML5 canvas-element and WebGL to make a simple 3D-game in first person view for fun. Ideally, I would like to control my movement by using the keyboard to move and the mouse to look around, like you usually do in FPS-games. As you probably understand, there are some limits to this in the browser, since the mouse cant be captured: When using the onmousemove event, no further movement will be detected when the mouse pointer reaches the border of my screen (which means that I wont be able to run in a circle for example) Seeing the mouse move across the screen is not the end of the world, but it is a little annoying From what I know, it's impossible to hide the mouse as well as setting it's position in JavaScript. Hence, my question is this: If we cant to those things, what can we do in order to get close to the desktop gaming experience when it comes to the mouse in the browser? And I mean right now, using current APIs. Not "what could be changed in some standard to make life easier". Also, I realize that I could use the keyboard to look around, but then we're back in 1995 when Quake were actually played like that. And of course I know that it would be easier to write a desktop application or use Flash at least, but Im trying to push JavaScript's limits here. Apart from those things, what are your suggestions? Any kind of reference, existing game, crazy idea, hack or even browser specific solution would be appreciated.

    Read the article

  • javascript :Object doesn't support this property or method

    - by Kaushik
    In my jsp page, I have in the tag, the following code: <script type="text/javascript" src="<%=request.getContextPath()%>/static/js/common/common.js"></script> <script type="text/javascript"> // Function for Suppressing the JS Error function silentErrorHandler() {return true;} window.onerror=silentErrorHandler; </script> If there is some javascript executing on the jsp page after this, then I guess silentErrorHandler() will have no effect. i.e. the error will still show on page. IS this correct? Because the error is showing and am not sure why. The second part of the question is this: The error is Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; AskTbFXTV5/5.9.1.14019) Timestamp: Fri, 7 Jan 2011 21:26:23 UTC Message: Object doesn't support this property or method Line: 613 Char: 1 Code: 0 URI: http://localhost:9080/Claris/static/js/common/common.js And finally, line 613 states document.captureEvents(Event.MOUSEUP); There is error on IE8. Runs fine on Mozilla and IE7. Any suggestions will be very helpful

    Read the article

  • "javascript:" on browser won't change the type.

    - by raj
    look at this code, <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script> function change() { document.getElementById("myInput").type="text"; } </script> </head> <body onload="setTimeout('change()',2000);"> <input type = "button" id="myInput"> </body> </html> now, my button becomes text box after 2 seconds.. Iam happy! Why not the same happens when i try to do from the browser (i tested in IE6 & Chrome) using javascript:document.getElementById("myInput").type="text" different browsers behave in different way... when i tried javascript:document.getElementById("myInput").value="myNewValue", IE6 changes the value, but chrome doesn't.. Why is this "javascript:" behaving like this ?

    Read the article

  • javascript error of unterminated string

    - by OM The Eternity
    I want pass a parameter of javascript functiona which is a string. This javascript function is a hintbox on mousehover.. and the string i am using is like this: Hemmed Finish: Every side/edge (1/2" to 2") of the banner are folded and glued (special vinyl solution) or heat pressed. This is the most common and best finish option. Stitched Finish: Every side/edge (1" to 2") of the banner are folded in the back and stitched/sewed with white thread. This is not a common option as thread can be seen on the banner. Now in the hintbox on mousehover the above given text has to be display as it is displayed above along with the paragraph break.. But when i pass the above as parameter in that function along with appending some backslashes to recognise some punctuation, iots till gives me javascript error of unterminated string... I am doing this: onMouseover="showhint('Hemmed Finish\: Every side/edge \(1/2\'\' to 2\'\'\) of the banner are folded and glued \(special vinyl solution\) or heat pressed. This is the most common and best finish option.Stitched Finish\: Every side/edge \(1\'\' to 2\'\'\) of the banner are folded in the back and stitched/sewed with white thread. This is not a common option as thread can be seen on the banner', this, event, '250px')" pls could u help me in rectifying the issue...

    Read the article

  • Valid javascript object property names

    - by hawkettc
    I'm trying to work out what is considered valid for the property name of a javascript object. For example var b = {} b['-^colour'] = "blue"; // Works fine in Firefox, Chrome, Safari b['colour'] = "green"; // Ditto alert(b['-^colour']); // Ditto alert(b.colour); // Ditto for(prop in b) alert(prop); // Ditto //alert(b.-^colour); // Fails (expected) This post details valid javascript variable names, and '-^colour' is clearly not valid (as a variable name). Does the same apply to object property names? Looking at the above I'm trying to work out if b['-^colour'] is invalid, but works in all browsers by quirk, and I shouldn't trust it to work going forward b['-^colour'] is completely valid, but it's just of a form that can only be accessed in this manner - (it's supported so Objects can be used as maps perhaps?) Something else As an aside, a global variable in javascript might be declared at the top level as var abc = 0; but could also be created (as I understand it) with window['abc'] = 0; the following works in all the above browsers window['@£$%'] = "bling!"; alert(window['@£$%']); Is this valid? It seems to contradict the variable naming rules - or am I not declaring a variable there? What's the difference between a variable and an object property name? Cheers, Colin

    Read the article

  • how to add class using javascript in div

    - by Fahim Parkar
    I have so many modules and I am showing border to each module. Below is what I have div.ja-moduletable-inner, div.moduletable-inner { background: none; padding: 1.5em; box-shadow: 0px 0px 3px 3px rgba(0,0,0,.25); } <div id="Mod143"> <div class="moduletable-inner clearfix"> </div> </div> <div id="Mod148"> <div class="moduletable-inner clearfix"> </div> </div> <div id="Mod149"> <div class="moduletable-inner clearfix"> </div> </div> Note : These modules are added by-default by Joomla, so I can't handle this. What I want is using Javascript, I want to add class in Mod149 so that I will have it as <div id="Mod149"> <div class="moduletable-inner clearfix newMyOwnClass">` ^^^^^^^^^^^^^^ </div> and I will have in css as div.newMyOwnClass { box-shadow: 0px 0px 0px 0px rgba(0,0,0,.25); ^^^^^^^ } Any idea how to get this done in Javascript? No jQuery... Only Javascript AND only with div id Mod149

    Read the article

  • JavaScript text slideshow not working?

    - by I Build Websites
    I'm making a Javascript slideshow for my blog yet the array doesn't seem to be working. Can someone please say what I've been doing wrong <SCRIPT type="text/javascript"> var blog = new Array() blog[0]= "<h4>Sunday 17 of June 2012</h4><p title='Blog'>Donec tempus risus eget ligula viverra eget placerat odio tincidunt. Duis nisl sem, scelerisque faucibus congue vitae, accumsan at lectus. Cras vestibulum arcu ut lorem luctus eu pharetra tortor ultricies. Nam iaculis orci mauris. Etiam luctus, mauris sed adipiscing ullamcorper, augue enim volutpat sem, ut sagittis ipsum nibh ac nulla. Nam ultrices, quam eget sollicitudin porta, sapien mauris pulvinar augue, posuere hendrerit erat ligula ut magna. Maecenas laoreet nisi vitae magna consectetur a mollis purus tristique. Pellentesque elementum arcu non urna convallis eleifend. Aliquam eu lorem sed risus tempus tempor. Donec malesuada velit in odio vulputate iaculis. In tristique neque quis velit posuere adipiscing. Nullam dui neque, scelerisque non egestas feugiat, pellentesque vitae mauris.</p><hr>" and so the array continues till function display1() { document.getElementById(blogShow).innerHTML( blog[0]) } function display2() { document.getElementById(blogShow).innerHTML(blog[1]) } function display3() { document.getElementById(blogShow).innerHTML(blog[2]) } function display4() { document.getElementById(blogShow).innerHTML(blog[3]) } function display5() { document.getElementById(blogShow).innerHTML(blog[4]) } </SCRIPT> <div id="blogShow"> <SCRIPT type="text/javascript">display1()</SCRIPT> </div> <div id="blogNav"> <input type="button" onClick="display2()" value="1" class="button"> <input type="button" onClick="display3()" value="2" class="button"> <input type="button" onClick="display4()" value="3" class="button"> <input type="button" onClick="display5()" value="4" class="button"> </div> I know it's all inline and i will clean up after it works

    Read the article

  • Embed javascript in markdown

    - by Paul Tarjan
    I'm using the Maruku markdown processor. I'd like this *blah* blah "blah" in [markdown](blah) <script src="code.jquery.com/jquery-1.4.2.min.js"></script> <script> ...do stuff... </script> but it complains when I render it with a multitude of errors. The first one being ___________________________________________________________________________ | Maruku tells you: +--------------------------------------------------------------------------- | Could you please format this better? | I see that "<script type='text/javascript'>" is left after the raw HTML. | At line 31 | raw_html |<script src='http://code.jquery.com/jquery-1.4.2.min.js' /><script type='text/javascript'>| | text --> |//<![CDATA[| and then the rest seems like the parser is going nuts. Then it renders the javascript into a div on the page. I've tried making it a CDATA block and extra spacing between the jquery and my script. Help?

    Read the article

  • How to insert <li> element on <ul> using pure javascript

    - by Damiii
    I am having an issue with javascript and i don't know how to solve it ... Actually my code is working good with jsfiddle, but when i try to insert on my HTML page ,it simply doesnt work anymore ... What i want to, is to add the < li on < ul each time i tried to hit the button named "Add" ! HTML code: .... <td width="50%" valign="top"> <b> SUPER: </b> <ul id="ul"> </ul> </td> .... <input type="submit" value="Add" onclick="add()"/> .... JavaScript code: <script type="text/javascript"> function add(){ var ul = document.getElementById("ul"); var li = document.createElement("li"); li.innerHTML = "LoL"; ul.appendChild(li); } </script> The result with that code : it doesn't add anything on my HTML page when i try to hit the button... Thankfully,

    Read the article

  • comparing value with array value problem Javascript

    - by Java starter
    This code is what I use now, it dos not work when I trie to use an array to compate values. If anybody has any idea of why, please respond. <html> <head> <script type-'text/javascript'> function hovedFunksjon() { //alert("test av funksjon fungerte"); //alert(passordLager); window.open("index10.html","Window1","menubar=no,width=430,height=360,toolbar=no"); } function inArray(array, value) { for (var i = 0; i < array.length; i++) { if (array[i] == value) return true; } return false; } function spørOmPassord() { var passordLager = ["pass0","pass1","pass2"]; window.passordInput = prompt("password");//Ved å bruke "window." skaper man en global variabel //if (passordInput == passordLager[0] || passordLager[1] || passordLager[2]) if (inArray(passordLager,passorInput) ) { hovedFunksjon(); } else { alert("Feil passord"); //href="javascript:self.close()">close window } } function changeBackgroundColor() { //document.bgColor="#CC9900"; //document.bgColor="YELLOW" document.bgColor="BLACK" } </script> </head> <body> <script type-'text/javascript'> changeBackgroundColor(); </script> <div align="center"> <form> <input type = "button" value = "Logg inn" onclick="spørOmPassord()"> </form> </div> </body> </html>

    Read the article

  • Add to a table with javascript

    - by incrediman
    I have a table which looks like this: <table id='t'> <thead> .... </thead> <tbody id='t_tbody'> </tbody> </table> thead is filled with content tbody is empty I want to use javascript to add this (for example) to t_tbody: <tr> <td>Name</td> <td>Points</td> <td>Information</td> </tr> How can I do this? I need a function which adds the above to t_tbody. Note that simply using document.getElementById('t_tbody').innerHtml+="<tr>...</tr>" works fine in FF, but not in IE. Also note that I need to use raw javascript (ie. no frameworks) for this project, as I am finishing a project which has already been mostly completed using raw javascript.

    Read the article

  • Javascript not reading value from hidden textBox - JQuery C#

    - by Paul van Valkenburgh
    I'm a non-specialist with JavaScript / JQuery and I'm having trouble figuring out why my script doesn't work. When my C# page loads, I have a hidden textBox txtHiddenKeywordArray which gets dynamically filled with comma separated values like... horse, buggy, track I'm trying to use the highlight functionality in jquery.highlight-3.js where I have a label text field that will contain and highlight the words in the keywords list. I'm using the script <script language="javascript" type="text/javascript"> var myString = document.getElementById('<%=txtHiddenKeywordArray.ClientID%>').val() myArray = myString.split(" "); $(document).ready(function () { for (i = 0; i < myArray.length; i++) $("p").highlight(myArray[i]) }); </script> Here is the textBox declaration : <asp:TextBox ID="txtHiddenKeywordArray" ClientIDMode="Static" runat="server" Visible="false"></asp:TextBox> It worked great when I hard coded the values of var myString. I've tried researching it and keep seeing the same example of the way I have it done. The page does use a MasterPage. Could this affect it? Any idea how I can get the script to see the values from the textbox? Do I need a RegisterStartUpScript or something? Thanks for any help you can provide.

    Read the article

  • Javascript OOP - accessing the inherited property or function from a closure within a subclass

    - by Ali
    Hi All, I am using the javascript inheritance helper provided here: http://ejohn.org/blog/simple-javascript-inheritance/ I have the following code, and I have problem accessing the inherited property or function from a closure within a subclass as illustrated below. I am new to OOP javascript code and I appreciate your advice. I suppose within the closure, the context changes to JQuery (this variable) hence the problem. I appreciate your comments. Thanks, -A PS - Using JQuery 1.5 var Users = Class.extend({ init: function(names){this.names = names;} }); var HomeUsers = Users.extend({ work:function(){ // alert(this.names.length); // PRINTS A // var names = this.names; // If I make a local alias it works $.map([1,2,3],function(){ var newName = this.names.length; //error this.names is not defined. alert(newName); }); } }); var users = new HomeUsers(["A"]); users.work();

    Read the article

  • Sending variable data from one of two text boxes to javascript

    - by Enyalius
    Greetings, all! I am fairly new to JS (my background is in C++, enterprise languages like assembly and COBOL, and some light .NET), so I was wondering if I could get some advice regarding how to send variable information from one of two text boxes to some javascript and then have the JS do some basic checks and such. Here's the pseudocode for what I am trying to do: <form = webForm> <p> _____________ textboxPeople| searchIcon //a text box to search an online phonebook at my company. ------------- //It has a little "magnifying glass" icon to search //(onClick), but I would also like them to be able to //search by hitting the "enter" key on their keyboards. </p> <p> _____________ texboxIntranet| searchIcon //Same as above search textbox, but this one is used if ------------- //the user wishes to search my corporate intranet site. </form> So ends the front-facing basic form that I would like to use. Now, onClick or onEnter, I would like the form to pass the contents of the text box used as well as an identifier such as "People" or "Intranet," depending on which box is used, to some basic JS on the back end: begin JavaScript: if(identifier = 'People') fire peopleSearch(); else if(identifier = 'Intranet') fire intranetSearch(); function peopleSearch() { http://phonebook.corporate.com/query=submittedValue //This will take the person //that the user submitted in the form and //place it at the end of a URL, after which //it will open said complete URL in the //same window. } function intranetSearch() { http://intranet.corporate.com/query=submittedValue //This will function in the //same way as the people search function. } end JavaScript Any thoughts/suggestions would be greatly appreciated. Thank you all in advance!

    Read the article

  • Spring MVC - Set an actionURL parameter with Javascript

    - by jeffl8n
    Is it possible to dynamically set a Spring MVC portlet:actionURL portlet:param using javascript? I have tried with the following code, but the id value always comes across as null to the controller. I have verified that setting the portlet:param manually passes the value correctly: <portlet:param name="id" value="2" /> I have also verified the value in the javascript is being set correctly and is not null. (Note: I've changed the variable names, etc. from the original code to simplify it and obfuscate it since it is my employer's code.) JSP: <portlet:actionURL var="modifyURL"> <portlet:param name="do" value="modify" /> <portlet:param name="id" value="${model.id}" /> </portlet:actionURL> ... <form:form action="${modifyURL}" id="modifyForm" modelAttribute="model"> <form:hidden path="id" id="id" /> </form:form> Javascript called when the update URL is clicked: function update() { document.forms[0]["id"].value = selectedId; document.forms[0].submit(); } Controller: @RequestMapping(params = {"do=modify"}) public void modify(@ModelAttribute("model") Model model, @RequestParam(value = "id", required=true) Long id, ActionRequest request, ActionResponse response, SessionStatus sessionStatus, ModelMap modelMap) { ....

    Read the article

  • Creating and parsing huge strings with javascript?

    - by user246114
    Hi, I have a simple piece of data that I'm storing on a server, as a plain string. It is kind of ridiculous, but it looks like this: name|date|grade|description|name|date|grade|description|repeat for a long time this string can be up to 1.4mb in size. The idea is that it's a bunch of student records, just strung together with a simple pipe delimeter. It's a very poor serialization method. Once this massive string is pushed to the client, it is split along the pipes into student records again, using javascript. I've been timing how long it takes to create, and split, these strings on the client side. The times are actually quite good, the slowest run I've seen on a few different machines is 0.2 seconds for 10,000 'student records', which has a final string size of ~1.4mb. I realize this is quite bizarre, just wondering if there are any inherent problems with creating and splitting such large strings using javascript? I don't know how different browsers implement their javascript engines. I've tried this on the 'major' browsers, but don't know how this would perform on earlier versions of each. Yeah looking for any comments on this, this is more for fun than anything else! Thanks

    Read the article

< Previous Page | 50 51 52 53 54 55 56 57 58 59 60 61  | Next Page >