Jump to content

Search the Community

Showing results for tags 'javascript'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








  1. Hey, while reading the javascript tutorial I found some mistakes on this site. It input of most some methods is wrong or confusing. For example the method createElement gets the same input as replaceChild. Greetings.
  2. Hello, while reading the tutorial about js i found this paragraph: According to Stack Overflow fullName is not a function, because the result depends on the state of the object and is not always the same. Maybe you need to correct this or be more precise with your definition of a function.
  3. Hello, I have created this code: if (w > maxWidth || h > textHeight) { if (y < x) { [y, y] } else { [x, x] } } else { [value[0], value[1]] } It is a piece, but it gives to understand what I want to optimize without the rest. How to modify this code to work with: Switch Statement instead If/Else mode? This is a expression of After Effects. Thanks.
  4. To sum things up... I'm looking for as much reviews as possible. I've been working on minestatus for the last year now. I've come across many programming roadblocks and developments to further improve the quality, user impression, user interface, and user engagement. If you guys have any ideas on how to make my site better in any of those categories that would be amazing. Thank so much! Link to site: http://minestatus.co Site Name: MineStatus Site Description: MineStatus is a new social sharing plateform I've created. It allows users to make there own profiles, upload content, display the content. You can even share your content on MineStatus to almost any other social network without flaw. I plan on making a developer site to go along with it to share my practices with everybody. Site Owner/Developer: Myself, I am the lead developer and creator of MineStatus Network Site Address: Here is the link to the site : https://minestatus.co Extra Info: Some technologies I've already integrated: Open Graph Protocol* Twittercards* *for those who don't know here is a link, Open Graph Protocol, Twittercards.
  5. hi. a blind it student doing a web based audio space invaders game for the blind. pulled different bits of code from different tutorials to learn. now, need some mentoring. if any javascript or scripting gurus here, need your help. have done the code, but not sure if it is right, can some one help me out and take a look, then show me a better way to do things. then i then need to go and find a mespeak.js speech api, and then some more human voices, and see if i can find a tutorial. about how to speak out the objects on the screen, and also then just need multiplayer, regions area, updates, and then play over the internet. if this is not the right place, then i apologise. i use a screen reader jaws for windows from http://www.freedomscientific.com, and using windows 10 64 bit pro on a toshiba satellite pro c-50-a. so, if some one can work with me and help me out, did do a text based text to speech hangman game in visual basic 2010 in 2012. now first time doing a web based game. so i need a gentle push in the right direction, so sort of stuck at the moment. can any one help. if this is not the right forum, did post on scripting, but heard from no one. can any one help. thanks.
  6. Hello everybody, I'm new in angular so sorry if my question is ridiculous. I have a drag and drop file area and when I put a file I put his details (attributes: name, size, type) on inputs disabled because I don't want that users can change them. All of that is a form, so I want to save this with angular in scopes. Here my code: <div ngf-drop ngf-select ng-model="files" class="drop-box" ngf-drag-over-class="'dragover'" ngf-multiple="true" ngf-allow-dir="true" accept="{{acceptSelect}}" ngf-pattern="pattern" required>Arrastre y suelte su archivo aquí</div> <div ngf-no-file-drop>File Drag/Drop is not supported for this browser</div> <br> <div class="preview"> <div>Detalles del video: <div style="clear:both" class="videodetails" ng-repeat="file in files"> <div class="form-group"> <label class="col-md-4 control-label" for="fileName">{{ "Nombre" }}</label> <div class="col-md-5"> <input id="fileName" type="text" ng-model="file.name" disabled> </div> </div> <div class="form-group"> <label class="col-md-4 control-label" for="fileSize">{{ "Tamaño" }}</label> <div class="col-md-5"> <input id="fileSize" type="text" ng-model="file.size" disabled> </div> </div> <div class="form-group"> <label class="col-md-4 control-label" for="fileType">{{ "Tipo" }}</label> <div class="col-md-5"> <input id="fileType" type="text" ng-model="file.type" disabled> </div> </div> JavaScript: $scope.file = function (data) { $scope.file.fileName = data.name; $scope.file.fileSize = data.size; $scope.file.fileType = data.type; } I don't know what I'm doing wrong. Any help? Does anybody know to fix it? Thank you very much!
  7. I have developed a html template using table, something like below. I'm having problem to insert the data from mysql to be inserted in specific column in the html table. Could anybody help me.. _________________________________________________________________________ |Name: | |Student ID:| | |Address: | | | |Postcode:| |
  8. Hi, I am currently trying to implement the posting of a canvas image to a Twitter wall.Below, first you see the JS I came up with.What I can't figure out is how am I supposed to get the keys and tokens provided in the PHP function below that code. Such PHP function is contained in the uploadFile.php file.JS: var base64img = canvas.toDataURL().split(',')[1]; $.ajax({ url: "uploadFile.php", type: "POST", data: base64img, processData: false, contentType: "application/octet-stream", }).done(function(respond) { alert(respond); }); PHP: function _microsite_last_tweets($search) {define('CONSUMER_KEY', 'my key');define('CONSUMER_SECRET', 'my key');define('ACCESS_TOKEN', 'my key');define('ACCESS_TOKEN_SECRET', 'my key');$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);$content = $connection->get("account/verify_credentials");if ($search[0] == '@' && strpos($search,' ') == false) {$user = substr($search, 1);$tweets = $connection->get("statuses/user_timeline", array("screen_name" => $user, "count" => "4"));}else {$search = urlencode($search);$tweets = $connection->get("search/tweets", array("q" => $search . '+exclude:retweets', "result_type" => "recent","count" => "4"));}return $tweets;}
  9. So, I do not have a specific code, but I just want to understand collision. I guess an example that I am thinking of is agar.io. I have read many examples about collision, or how in agar.io the cells eat eachother, and it just doesn't make sense. Could anybody please explain it to me, and use it in an extremely simple code. I am very much a beginner. I have learned about html, javascript, and jquery using codecademy, but I am not experienced!! Could someone please give me a simple explanation of how to make 'cells eat eachother' using a simple code. Again, I am a beginner! Thanks for any help.
  10. Hi, I created a simple badge generator app here. I am using the html5 file input and <canvas> to display a badge template and the user has to select the picture. The problem is that sometimes (randomly?), as soon as the image is selected, it doesn't show up in the pixels I designated it to appear in. A quick debug made clear that, when this occurs, the image object is there but it has width 0 and height 0 (see screenshot below).
  11. Hello there, I am plan (in near future) to start with learning and training with node.js. Since I have habit to learn and remind from w3s (manner of writing), do you plan to add some tutorials and references for node.js? Thank you for all!
  12. Hello; This is the first time I have posted to this forum. I have been developing javascript and php in web related context for some time. But there is always some detail that gets solved at some point, but solution is buried in old code somewhere. I am currently trying to get javascript to set a hidden field from the selection a user makes from a set of radio buttons. I have googled around and found some reference an a clue in "current value" but that won't fly in javascript, and the actual syntax was not provided...... SO: here is some code var closeSAOOpt = function() { var opt = document.forms.script.openOpt.currentValue alert(opt) } alert in code above produces "undefined". I know one of the radios is checked. I have varified that openOpt is in fact the radio group name and that it is assigned to both radio button name values. I know the document.forms.script is defined, and that javascript won't accept spaces in variable names. So I have assumed 'current value' is currentValue in javascrip But what "undefined" is referring to is often not obvious. The funtion above is called in an eventlistener attached to a button element labeled "Done" Can I get a hand with this from someone? Thank you for time and attention.
  13. Hello all, Context: I work at a small print shop; I'm in charge of my company's online storefronts where customers can order printed goods. We use EFI Digital StoreFront and just got a new extension/program/plugin called Directsmile that lets us offer products with variable data and mailing lists. The program works with InDesign; I build the art file in InDesign and Directsmile links to InDesign to add variable data fields to InDesign's text fields and image frames. When multiple data fields are used together, their rules need to be defined so if one field is not used, the others will move up to fill in the gap. Extra characters like divider characters and phone number labels (eg. "fax 123.456.7890") are also defined in the rules, so they only appear when the associated field is in use. I define those rules using Directsmile. I can choose to either use the built in tool to define the boolean properties of the variable data fields, or for more complicated formatting, I can use javascript. See below for an example of how phone numbers are formatted on a business card: The Problem: The people who designed Directsmile figured that if somebody wanted to use variable data for an image, it was going to be fixed in one place, and wouldn't be positioned in relation to the other fields. Directsmile supports variable data images placed in fixed positions on the page, and it supports very flexible variable data text with positioning relative to other variables in the same text box, but it does not support image frames inserted into text boxes. When I try it, the image frame vanishes. Because of this, there is a problem with variable images inserted between sections of variable text: The customer can choose to fill in any of the fields, or none, so the positioning of every element varies with each data merge record. I can't put the image inside the text box; they have to remain as independent elements. But as independent elements, they will not be placed properly on the page; the image will remain entirely static, and text that runs too short will leave a gap where text that runs long will run over/behind the image. Also, if the customer chooses not to use the image field, the second section of text will be orphaned down the page instead of moving up to fill in where the image would have been. The Solution? The only potential workaround I can think of would be to use js on a text box (like the "numbers" field in the business card example) to define: -placement of text and image -if there is an image, then insert appropriately sized space between sections of variable text -if there is text above the image, the image is moved down the page one line height for every line of text above Except, I don't know how to use javascript to place an image, or how to position it according to how many lines of text are preceding. I don't even know if that's possible. If I could be pointed in the right direction, I would be so grateful. I'm a print designer, not a programmer; I consider myself proficient at HTML and CSS but javascript is like trying to read a foreign language- I can pick up on the gist of things, but I have a LOT of difficulty writing it and knowing exactly what each bit does. I am learning, but commerce waits for no man and I will likely need a solution before I can come up with one independently so I'm trying to head this off. I've already talked to product support for help, and they didn't know of a way to achieve this, though they couldn't think of anybody who'd ever tried it, either, so I would really appreciate any help or tips you could give me. I'm sorry I don't have any script to show for this particular project, but I don't even know where to begin! Please bear with me in my ignorance. I know this is a really weird application of javascript and it doesn't help things any. Thank you all for reading that wall of text, and for any assistance!
  14. <head> <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script> <script type="text/javascript" src="jquery.isotope.js"></script> </head> <div class="container"> <div class="categories"> <ul class="cat"> <li class="pull-left"><h4>PHOTOS</h4></li> <li class="pull-right"> <ol class="type"> <li><a href="#" data-filter="*" class="active">ALL</a></li> <li><a href="#" data-filter=".childhood">CHILDHOOD</a></li> <li><a href="#" data-filter=".concerts">CONCERTS</a></li> </ol> </li> </ul> <div class="clearfix"></div> </div> <div id="lightbox" class="row"> <div class="col-md-4 childhood"> <div class="portfolio-item"> <img src="img/photos/childhood/img5.jpg" class="img-responsive" alt="Childhood Images "> </div> </div> <div class="col-md-4 childhood"> <div class="portfolio-item"> <img src="img/photos/childhood/img2.jpg" class="img-responsive" alt="Childhood Images "/> </div> </div> <div class="col-md-4 childhood"> <div class="portfolio-item"> <img src="img/photos/childhood/img3.jpg" class="img-responsive" alt="Childhood Images /> </div> <div class="col-md-4 concerts"> <div class="portfolio-item"> <img src="img/photos/concerts/img1.jpg" class="img-responsive" alt="Concert Images"> </div> </div> <div class="col-md-4 concerts"> <div class="portfolio-item"> <img src="img/photos/concerts/img1.jpg" class="img-responsive" alt="Concert Images"> </div> </div> </div> </div> <script type="text/javascript"> $(window).load(function() { var $container = $('#lightbox'); $container.isotope({ filter: '*', animationOptions: { duration: 750, easing: 'linear', queue: false } }); $('.cat a').click(function() { $('.cat .active').removeClass('active'); $(this).addClass('active'); var selector = $(this).attr('data-filter'); $container.isotope({ filter: selector, animationOptions: { duration: 750, easing: 'linear', queue: false } }); return false; }); }); </script> </body> </html> I am using bootstrap and for the image gallery filtering i'm using jquery.isotope.js.This perfectly works in chrome and images are rersponsive.But in IE and firefox,images will not be responsive when window is smaller than 760px.Tried a lot.If I make it responsive ie.smartresize fn,then flitering does not work.Also tried new version of isotope.Then filtering doesn't work,images stay responsive. How to resolve the problem?Pl someone help me...
  15. <script> function sendData(form) { var postform = new FormData(); var fileselect = document.getElementById('mypic'); var files = fileselect.files; postform.append('SBP_Details', document.getElementById('Details')); // Loop through each of the selected files. for (var i = 0; i < files.length; i++) { var file = files[i]; // Check the file type. if (!file.type.match('image.*')) { continue; } // Add the file to the request. postform.append('upload_file[]', file, file.name); } // postform.append('upload_file', document.getElementById('mypic')); var xmlhttp = new XHRObject(); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { //xmlhttp.responsetext will have what is sent back - use Print_R in php } } xmlhttp.open("POST","http://stxxx.co.uk/SBPostPost.php", false); xmlhttp.setRequestHeader('Content-Type','multipart/form-data'); xmlhttp.send(postform); } </script> Getting very confused by all the options available - could someone please help. I'm developing a hybrid HTML5/JS App in XDK that sends form data and a picture file to a php server. I can get the data fields but struggling with a file. The JS that sends is as above.; When debugging the console looks as thou it's sent ok but the PHP that echoes $_POST and $_FILES just shows an empty array ... Can Anyone point me to a tutorial that shows bot sides (JS and PHP ) please
  16. For example, here: http://www.w3schools.com/js/js_performance.aspJavaScript PerformanceReduce Activity in loopsBad Code:for(i - 0; i < arr.length; i++)Better Code:l = arr.length;for(i = 0; i < l; i++)The bad code accesses the length property of an array each time the loop is iterated.The better code accesses the length property outside the loop, and makes the loop run faster. But an example here: http://www.w3schools.com/js/js_htmldom_nodelist.asp JavaScript HTML DOM Node ListHTML DOM Node List LengthThe length property is useful when you want to loop through the nodes in a node list:ExampleChange the background color of all <p> elements in a node list: var myNodelist = document.getElementsByTagName("p");var i;for (i = 0; i < myNodelist.length; i++) { myNodelist[i].style.backgroundColor = "red";}is inconsistent with that advice.// for (var i = 0, j = myNodelist.length; i < j; i++) { ? }
  17. Basic JavaScript learning - should be started by knowledgeable and competant persons for the benefit of the beginers or the first time learners. websites is a huge domain where almost everyone is trying to put up themselves exhibiting their skills, experiences, motivation and designs. Could someone kindly consider this request for larger interests of the society of interested javaScript learners.
  18. Hello, I am relatively new to javascript although I have used some over recent years in my html web pages. I have a specific problem in which I have a form with an input box that I must validate as true or false. This part works. The call to another javascript will only work if tagged as target="_blank". I want to open the new url in the same window and nothing I have found on internet has worked. Here is my code: <script type="text/javascript"> function gotoProductWebPage() { var answer = document.getElementById("answer").value; if(answer==8){ nowbaby(); return true; } else { alert("Check your Math"); return false; } } </script> <Script type="text/javascript"> function nowbaby() { window.open ("myurl,"_self",false); }​ and here is the call from form: <form method="get" name="myname" onsubmit="gotoProductWebPage()">​ and here is html snippet: <p style='color:blue;text-align:center' > Enter answer to prove you are human. A=3, B=5, A+B=<input type="number" id="answer" size="6" name="answer" /><br /> </p> <p align='center' > <input type="submit" name="Submit" value="Submit" /> </p>​ Like I said, if I make it _blank it will open in new window, but for the life of me, I cannot get it open in same window. I have tried: window.location.href = "myurl" window.open("myurl/pid='0000","_self") location.ref and nothing seems to work. I am stumped. Please Help. I am working in IE and Edge, sorry should have referenced that.
  19. I'm practising js on an another site and I do not know how to solve this problem. It's simple and I wrote a code, but it doesn't work.-You are a creature of habit. Every week you buy 5 oranges. But orange prices keep changing!You want to declare a function that calculates the cost of buying 5 oranges.You then want to calculate the cost of the 5 all together.Write a function that does this called orangeCost().It should take a parameter that is the cost of an orange, and multiply it by 5.It should log the result of the multiplication to the console.Call the function where oranges each cost 5 dollars.-and this is a code that I wrote:var orangeCost = function(price) {var val = price * 5;console.log(val);};orangeCost = (5);I could use some help...
  20. tech991

    Bookmark system

    Hi to all. I'm new in php development. I'm trying to do a bookmark system. I have an intern search engine that extract data from a database table build in MYSQL that show as link and the user can click on and appear es text html. I want to give the possibility to add a star button near these link and when the user click on to bookmark. I found 2 ways to do this, but I'm sure that exist more solution that can do better or not: 1- Give the possibility to the user that when click on button near the link that extract data from the database to add this on a bookmark table. 2- When the user click on button add data to a the bookmark browser with a javascript as this (http://stackoverflow.com/questions/10033215/how-do-i-add-an-add-to-favorites-button-or-link-on-my-website). I think is the easiest solution but I'm not sure what can do the correct way to this. Any advice is welcome:)
  21. Hi, i am playing a game and there is a user in chat that bothers me and other players a lot but he does not break any game rule... i was wondering if there is a way i could block or mute his text with a JavaScript if so, does anyone have a tutorial on how to code something like this? the chat have no ID but every chat message is put out like this. <table border="0" padding="0" cellspacing="0" width="100%"> <tbody> <tr> <td width="90" class="chat"> <div id="202525"></div> 2015-08-24 06:06:00 </td> <td style=""> <a href="javascript:newmsg('The Martyr','')" style="">The Martyr:</a> " so I starting to give up" </td> </tr> </tbody></table> and it looks like this in chat: 2015-08-24 06:06:00 The Martyr: so I starting to give up i was thinking i could use the user name 'The Martyr' in some way to block that user i would love to code something that would just remove the lines from the chat box. and any other line the user typed and will type. i just have no idea where to start. any kind of help would be appreciated thanks
  22. What is the best way to delete empty input fields, should I use php or javascript or another language? In the script the user can fill 3 or 5 input fields in the browser by html. The data will be stored in the database. But empty fields shouldnt be stored. Finally I also want to stop other crappy input, like mistakes etc. Im not sure which language is used for this matter. Is it possible to use php or is javascript better? My first focus is deleting empty input fields.
  23. What does !! in javascript mean? I cannot find it in http://www.w3schools.com/js/js_operators.asp And also, where can I look up these operators? You know, typing operators (like !!) in Google normally returns nothing.. Thanks!
  24. I have developed a simple html page. In that page there is a html button. If any user browses the page with Edge Browser then a message will show to click on that button to visit the page in Internet Explorer. To open Internet Explorer I have Used ActiveXObject. But the button is not working to launch Internet Explorer in Edge Browser. The code is given bellow. function LaunchIE() {var obj = new ActiveXObject("WScript.Shell");var ie = "C:Program FilesInternet Exploreriexplore.exe";obj.Run('"' + ie + '"', 1);} Can anyone please give me suggestion.
  25. im trying to output a json file to an expandable tree using html and jquery. its working, but the nesting and nodes within the tree are misplaced. any idea what that is? for example. mainstation 2 is coming out as a child of mainstation 1, while they should be siblings. it should be a logic error html code:<!DOCTYPE html><html> <head> <meta charset="UTF-8" /> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $.ajax({ url: "converted39.json", dataType: 'json', success: function(tree) { traverse($('#treeView'), tree) $('#treeView li:has(li)').addClass("Max").click(function(e) { $(this).toggleClass("Max Min"); $(this).children("ul").toggle(); e.stopPropagation(); }) $("[href]").addClass("Blue").click(function(e){ $(this).toggleClass("Purple"); e.stopPropagation(); window.location.href = $(this).attr("href") }) $('#treeView li').click(function(g) { var mytree2 = $(this); mytree2.children('li').toggle(); g.stopPropagation(); }) } }) }); function traverse(node, o) { for (var i in o) { if(i == "__text" || i == "_href" ) continue; if (o !== null && typeof(o)=="object") { if(o.__text){ var ul = $("<ul>").appendTo(node) var node=$('<li>').appendTo(ul) if(o._href){ var n = $("<span>").appendTo(node) $(n).text(o.__text).attr("href", o._href) } else{ $(node).text(o.__text) } } } traverse(node,o); } else{ var ul = $("<ul>").appendTo(node) if(o.__text){ var li = $('<li>' + o._text + '</li>').appendTo(ul) if(o._href){ var n = $("<span>").appendTo(node) $(n).text(o.__text).attr("href", o._href) } }else{ $('<li>' + o + '</li>').appendTo(ul) } } } } </script> JSON CODE:{ "MAIN": { "MainStation": [ { "Substation": [ { "Control": "Control1n", "ControlExpandable": { "MiniControl": [ "MiniControl1", "MiniControl2" ], "__text": "Control2" }, "PushButton": { "__text": "PushButton1", "_attr": "successnDatffffffffffffffffffffffffffffffffffffffffffffffffffffffffe:17july" }, "_href": "http://google.com", "__text": " Substation1nnnnnnn" }, { "ControlExpandable": { "MiniControl": [ "MiniControl1", "MiniControl2" ], "__text": "Control1", "_attr": "Control1 woohoo" }, "Control": "Control2", "PushButton": "PushButton1", "__text": " Substation2nnnnnnn" }, { "Control": [ "Control1", "Control2", "Control3", "Control4" ], "__text": " Substation3nnnnnnnnn" }, { "PushButton": [ "PushButton1", "PushButton2" ], "__text": " Substation4nnnnn" } ], "__text": " Mainstation1nnnnnnnnn" }, { "Substation": [ { "Control": [ "Control1", "Control2" ], "PushButton": "PushButton1", "__text": " Substation1nnnnnnn" }, { "ControlExpandable": { "MiniControl": [ "MiniControl1", "MiniControl2" ], "__text": "Control1" }, "Control": "Control2", "PushButtonExpandable": { "MiniPushButton": [ "MiniPushButton1", "MiniPushButton2" ], "__text": "PushButton1" }, "__text": " Substation2nnnnnnn" } ], "__text": " Mainstation2nnnnn" } ], "ElectricStation": { "Substation": [ { "Control": [ "Control1", "Control2" ], "PushButton": "PushButton1", "__text": " Substation1nnnnnnn" }, { "ControlExpandable": { "MiniControl": [ "MiniControl1", "MiniControl2" ], "__text": "Control1" }, "Control": "Control2", "PushButtonExpandable": { "MiniPushButton": [ "MiniPushButton1", "MiniPushButton2" ], "__text": "PushButton1" }, "__text": " Substation2nnnnnnn" } ], "__text": " ElectricStation1nnnnn" }, "__text": " MAINnnnnnnn" }}
  • Create New...