Jump to content

Search the Community

Showing results for tags 'js'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

  1. <body> hello all <script> document.write(5+7); document.write(4); </script> </body> Above basic js code outputs: hello all 124 There is no concatenation between "hello all" and "12", yet space is there. I'd appreciate an explanation.
  2. Hi,I am developing my first website template. When I used this script in the internal script, it ran well. But when I added this script inside a file,the jsLint showed that there was almost 20 errors. Here I am sending the screen of the errors. Can you please help me to understand why these errors occurred and how can I resolve these? Here is the script: function openModalSearch() { 'use strict'; var modalSearch = document.getElementById("modal-search-container"); modalSearch.style.height = "100%"; } function closeModalSearch() { 'use strict'; document.getElementById("modal-search-container").style.height = "0%"; } function hideSearch() { 'use strict'; document.getElementById("search-container").style.visibility = "hidden"; } function showSearch(){ 'use strict' document.getElementById("search-container").style.visibility = "visible"; } Thank you in advance......
  3. Hi, I am facing problem to undestand the showSlides() function . Can you please explain this function to me . var slideIndex = 1; showSlides(slideIndex); function plusSlides(n) { showSlides(slideIndex += n); } function currentSlide(n) { showSlides(slideIndex = n); } function showSlides(n) { var i; var slides = document.getElementsByClassName("mySlides"); var dots = document.getElementsByClassName("dot"); if (n > slides.length) {slideIndex = 1} if (n < 1) {slideIndex = slides.length} for (i = 0; i < slides.length; i++) { slides[i].style.display = "none"; } for (i = 0; i < dots.length; i++) { dots[i].className = dots[i].className.replace(" active", ""); } slides[slideIndex-1].style.display = "block"; dots[slideIndex-1].className += " active"; }
  4. Hi everybody http://www.w3schools.com/js/js_array_sort.asp If I'm right, the JS-Tutorial about sorting arrays randomly has a lack. The order of the array is kind of in a random order at the first glance, but the elements often stay at the same place as they were. This is true in the most for the element at the end of the array and the effect happens in most browsers, but not in all of them. I've written a script to test this. In these browsers the elements are not evenly distributed as they should: Chrome, IE, Edge, Opera. In Safari they were evenly distributed when I tried it. Try it yourself. <!DOCTYPE html> <html> <body> <p id="demo"></p> <script> var sum; var points; var i, j; sum = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; for (i=0;i<1000;i++){ points = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]; points.sort(function(a, {return 0.5 - Math.random()}); for (j=0;j<points.length;j++){ sum[j]+=points[j]; } } document.getElementById("demo").innerHTML = sum; </script> </body> </html> What the code does: It creates an array with a leading 1 and a 1 at the last place and zeroes between (points). Then it sorts this array randomly and adds the resulting array to a sum array. Then it starts again with the specific array. The generating, sorting and adding is done a 1000 times. When you reload the page the summed up numbers are displayed. Result: In many browsers the last number is higher than the others, which shouldn't happen with correct random sorting. Cheers, celus
  5. Hi, I am a beginner web designer and developer. Now I am learning javascript. But while learning I didn't understand the bitwise operators and how they works. In the below image how X converts to decimal? Please help as many experienced and professional web developers are present here. Thank you.
  6. Hi all, I would like to understand how JS/jQuery can interact with PHP to upload a status and a picture from the HTML5 canvas to Twitter. I set up a similar thing for FB and it works. I don't get how to do it for Twitter and I haven't found much about it. Could you explain to me how it works? I currently have this JS/jQuery code as a starting point: var formData = new FormData(), mimetype = canvas.toDataURL().substring(canvas.toDataURL().lastIndexOf(":") + 1, canvas.toDataURL().lastIndexOf(";")), blob = dataURItoBlob(canvas.toDataURL().split(',')[1], mimetype); formData.append('source', blob); $('#twitter').click( function() { $.ajax({ url: '', type: 'POST', data: formData, processData: false, contentType: false, cache: false, success: function() { $('#twitter').addClass('twitter-success'); setTimeout( function() { $('#twitter').removeClass('twitter-success'); }, 3000); } }); } ); Thank you!
  7. I don't seem to get my head around the reason why the following returns TypeError: Object.values is not a function var input = '[a docs/my_pdf.pdf|here§my_class#my_id][img imgs/myimg.jpg|Alt title][g Artificial Languages][lang]HTML, CSS, Sass, SMACSS, SVG[y]7[/y][/lang][/g][p]Yes[/p]'; var RegEx = { 'tagClass': { '\§\s*(.+?)\s*[\§\|\]\#]': ' class="$1"' }, 'tagId': { '\#\s*(.+?)\s*[\§\|\]\#]': ' id="$1"' }, 'tagAlt': { '\[img.+?\|\s*(.+?)\s*[\§\|\]\#]': ' alt="$1"' }, 'tagTitle': { '\[a.+?\|\s*(.+?)\s*[\§\|\]\#]': ' title="$1"' }, 'tagSrc': { '\[img\s*(.+?)\s*[\§\|\]\#]': ' src="$1"' }, 'tagHref': { '\[a\s*(.+?)\s*[\§\|\]\#]': ' href="$1"' }, 'tagAngleBrackets': { '\[(\/?)(.+?(?=[\]]))\]?': '<$1$2>' } }; for (var tag in RegEx) { input.replace(new RegExp(Object.keys(RegEx[tag])[0], 'g'), Object.values(RegEx[tag])[0]); }
  8. Hi everybody. First at all, I specify I'm French and I'm sorry if my English isn't perfect. I've chosen this forum because I didn't find a solution with many French forums. A friend has advised to me this forum to expose my problem. I would like to add an animation to my html page by using JS. Let me explain ; for the time being, there's only one picture <img> on my page, it's a candle image. I would like to add an animation by using JS (or something else it doesn't matter) giving the impression of being near to the flame, if you know what I mean. I don't want to see the flame's move or to modify the picture, but just a light effect by using luminosity. I'm not a very high level in JS, and I don't know if I should use randomly variables and change luminosity or something else. If you could show me an example I would be grateful (: Thanks in advance, -Flo
  9. 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.
  10. Hi, As you know, there is W3C markup validation service. Is there a reliable validation service for PHP, MySQL, JS (other than Chrome's console), and CSS?
  11. Hi, For all pages, there is a language link in the header that is created with the help of a jQuery link. For only one page, however, there is another jQuery link (besides the first jQuery) to make a text collapsible/uncollapsible. I placed both links along with their associated js files before the closing body tag. All pages are fine, except the one having the two jQuery links--it has resulted in the disappearance of a text of another anchor link in the header not related to any function of the jQueries. It seems that the jQuery affecting the language link (anchor) is also affecting the other anchor of the header. How to make the second jQuery link not affect the other anchor link? Links are listed below. <script type= "text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"></script> <script type= "text/javascript" src= "./js/collabsible.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script> <script src="js/languageswitcher.js"></script>
  12. <php at the top of page> <followed by an html tags, then by below php> <?php include ('./includes/footer.html'); ?> <script type= "text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"></script> <script type= "text/javascript" src= "./js/collabsible.js"></script> For one odd page of the website I wanted to have collapsible/uncollapsible text using jQuery, so I placed the relevant scripts at the bottom of the page as seen above. It works. But in a previous communication it was stated that the ideal place for inclusion of js/jQuery scripts is before the closing tag of the body. The footer file, included before the scripts, closes the body and html tags, which means the scripts are placed even after the closed html. If scripts are placed before inclosure of the footer file, it would then be before some html tags. I cannot place them in the footer file before closure of the body tag because I need scripts in this page only while footer is also in the rest of site pages. It seems I have only two options: leaving them as seen above or make one additional footer page for this page only where I can place the scripts before body closure tag. Any help or guidance will be appreciated.
  13. Dear all: I have just started learning js and jQuery. I am confused about browser support to js. On one hand, there seems to be a general agreement that js is the most popular language for website design. On the other hand, It's stated that js is not equally supported by browsers, especially old browsers, and that some user browsers might even turn down js. jQuery is a better alternative for browser support. Is this true about problems in js' browser support? And if it is, how could a language with such a draw back become the most popular?
  14. Dear all: I know it is not usually normal to make double links of any file, however, since jQuery library can be linked to the page via the internet or locally, can we do both linking to achieve guaranteed loading if one fails and to make sure that getting the first link of the two would mean a faster loading? Is there any harm of doing so?
  15. In a js tutorial of w3schools it is mentioned that calling a js file is done either in the head or body; if in the body, it is preferable to be at the bottom to avoid slowing down page loading should the js loading is slow. Since the browser reads the page from top to bottom, it will hit the head first. Does that mean calling a js file at the bottom of the body is better than calling it in the head?
  16. Hey all i have following problem: I have a drag and drop editor which allow me to edit a URL, or allow me to edit a image trough a pop up screen. Now i want to change this so i edit the code of a image with URL (click able image). As you can see in the code below, everything works fine. Except it only shows 1 attribute So when i remove the <a></a> tags it shows the image url When i remove the <img></img tags it show the website url when i enable both only 1 shows up (website url) Anyone with a bit more javascript knowledge knows whats wrong ? Javascript: //edit link & image if(big_parent.attr("data-type")=='imagelink'){ $("#sim-edit-imagelink .imagelink").val(big_parent.children('img').attr("src")); $("#sim-edit-imagelink .imageurl").val(big_parent.children('a').attr("href")); $("#sim-edit-imagelink").fadeIn(500); $("#sim-edit-imagelink .sim-edit-box").slideDown(500); $("#sim-edit-imagelink .sim-edit-box-buttons-save").click(function() { $(this).parent().parent().parent().fadeOut(500); $(this).parent().parent().slideUp(500); big_parent.children('img').attr("src", $("#sim-edit-imagelink .imagelink").val()); big_parent.children('a').attr("href", $("#sim-edit-imagelink .imageurl").val()); }); html code <div class="sim-row-edit" data-type="imagelink" style="text-align:left"> <a href="http://google.be" target="_blank"> <img src="http://fietsendezwaluw.be/news/builder/img/layout1/img4.jpg" alt="" width="195" height="155" /> </a> </div> html code popup screen <div class="sim-edit" id="sim-edit-imagelink"><div class="sim-edit-box" style="height:330px;" ><div class="sim-edit-box-title">Edit image and url</div><div class="sim-edit-box-content"><div class="sim-edit-box-content-text">URL image:<span>(please use http://)</span></div><div class="sim-edit-box-content-field"><input type="text" class="sim-edit-box-content-field-input imagelink"/></div><div class="sim-edit-box-content-text">URL link:<span>(please use http://)</span></div><div class="sim-edit-box-content-field"><input type="text" class="sim-edit-box-content-field-input imageurl"/></div></div><div class="sim-edit-box-buttons"><div class="sim-edit-box-buttons-save">Save</div><div class="sim-edit-box-buttons-cancel">Cancel</div></div></div></div> Click here for the live example as you can notice when you press on a image it only show http://google.be and it doesn't show the image url.
  17. Dear all: I am intending to use jQuery for an FAQ collapsible/uncollapsible text. Because my FAQ will contain essential information, I am keen to have it visible to everybody. Is there any limitation in relation to browser support of jQuery that I should be aware of?
  18. Dear all: May I kindly request a help in providing a nice code for collapsing and expanding a block of text, e.g., blah blah blah read more... then at the bottom of the expanded page a way to collapse the block to original status. I searched the web and found some code in js, a language I don't know. Can that be achieved in PHP or html?
  19. Hey all, I have the code which display the result in a box, however i want to alter the code so it stores the result in a php session instead of displaying directly. //Preview$("#newsletter-builder-sidebar-buttons-cbutton").click(function(){ $("#sim-edit-export").fadeIn(500); $("#sim-edit-export .sim-edit-box").slideDown(500); $("#newsletter-preloaded-export").html($("#newsletter-builder-area-center-frame-content").html()); $("#newsletter-preloaded-export .sim-row-delete").remove(); $("#newsletter-preloaded-export .sim-row").removeClass("ui-draggable"); $("#newsletter-preloaded-export .sim-row-edit").removeAttr("data-type"); $("#newsletter-preloaded-export .sim-row-edit").removeClass("sim-row-edit"); preload_export_html = $("#newsletter-preloaded-export").html(); $.ajax({ url: "css/newsletter.css" }).done(function(data) { export_content = '<style>'+data+'</style><link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,900,200italic,300italic,400italic,600italic,700italic,900italic" rel="stylesheet" type="text/css"><link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"><div id="sim-wrapper"><div id="sim-wrapper-newsletter">'+preload_export_html+'</div></div>'; $("#sim-edit-export .text").val(export_content); }); $("#newsletter-preloaded-export").html(' '); }); Thanks in advance! funstad
  20. First of all, sorry if this is an inappropriate place to post this thread but I don't really know a better place to post it. This isn't any full time job, more of a partnership. I'm sure for a skilled programmer this would be rather easy.. But I am not one, which is why I'm looking for help.I want someone who can program games, such as a coin flipping game, slot machine game and games like blackjack (although, I have a coin flipping and slot machine game coded, just not by me) and integrate them with the Steam/CS:GO API, allowing users to log in, send CS:GO skins/knives (which can be very valuable) to a bot and then play these games for the chance of winning a lot more skins/knives.If you aren't fully accustomed to the Steam/CS:GO API then there are official Steam API guides. I have a couple more things I would like added which I will discuss if you contact me.Email: csgoroulettebusiness@gmail.comPay: All profits 50/50, a payment at the end could be arranged but I am spending a lot of money on other things important for the website (advertising although it's rather low-key, domains since I'm thinking about switching to a different one, creating a stockpile of skins/knives so that I can actually have the games functioning and not have people spending skins on games with no chance of winning anything and there's more I need to pay for but I hope you understand I'm not just BSing or something). Some of the more popular websites out there already make a lot of money from doing this, so if we improve upon what they've done, add more features, games etc and add a better monetary system, then the pay should be quite a lot, that is if all games/elements are implemented.Why bother helping?: First of all, the domain is already paid for, but like I said, I might buy a new off someone who's selling it. Quite a lot of the website is finished but there's still quite a bit more to do. You get to sleep soundly tonight knowing that you've helped a fellow programmer create something he loves. And, well, all you have to do is do some programming and sit back and watch the money roll in. Might sound too good to be true and although there's quite a bit of programming involved, it really is as simple as that. The websites out there are either basic, scams or just very poor and I hope to change that. I have plenty of new and fresh ideas which would entice a lot of CS:GO gamers and possibly even streamers to my website. I also have a different way for the site to earn money which greatly benefits both the creators and the users.Thanks for reading,Joe
  21. hi , i try to write a function that provide to change the image when i click on it: <body> <script> function hide(){ if (document.getElementById("image").src == "arrowup.png"){ document.getElementById("image").src = "arrowdown.png"; } else { document.getElementById("image").src = "arrowup.png"; } } </script> <img id="image" onclick="hide()" src="arrowdown.png" width="30" height="30"/> </body> but it doesnt work , what is the problem, please????
  22. hi! i'm new to HTML but i can programme with c,j2EE and JS , i want to know if there is a way to run my code in an html page, (i mean doing an application inside the HTML page);
  23. So I am learning JavaScript, and I come across this (which is one of the first things I learned about JS from your website, thank you). The first "method", if you call it that, which you show is the .innerHTML method to change the interior of an HTML element, given a named id. I have since learned other methods to be used with it, such as .value and .style. But I have never seen a comprehensive list of all the methods that can be used with this command. Either I'm not looking in the right place (which is entirely possible), or it's just not there. Since this is supposed to be a comprehensive website for all things related to web development, I think this would be a great addition to an already great website.
  24. Hi everybody! I just made this slider in an object oriented fashion. I would like to know how I can improve the script. Thank you! var Slideshow = function(element) { var totalWidth = 0; this.slider_wrap = element.find('.slider_wrap'); this.slider = element.find('.slider'); this.slide = element.find('.slide'); this.first_slide = element.find('.slide:first'); this.slider_controls_prev = element.find('.slider_controls_prev'); this.slider_controls_next = element.find('.slider_controls_next'); this.all_slides = this.slide.each(function(){ totalWidth = totalWidth + jQuery(this).outerWidth(true); }); this.maxScrollPosition = totalWidth - this.slider_wrap.outerWidth(); this.toSliderItem = function(jQuerytargetItem){ if(jQuerytargetItem.length){ this.newPosition = jQuerytargetItem.position().left; if(this.newPosition <= this.maxScrollPosition){ jQuerytargetItem.addClass('active'); jQuerytargetItem.siblings().removeClass('active'); this.slider.animate({ left : - this.newPosition }); } else { this.slider.animate({ left : - this.maxScrollPosition }); }; }; }; this.slider.width(totalWidth); this.first_slide.addClass('active'); this.buttons(); } Slideshow.prototype.buttons = function() { var that = this; this.slider_controls_prev.click(function() { var jQuerytargetItem = that.slider.find('.active').prev(); that.toSliderItem(jQuerytargetItem); }); this.slider_controls_next.click(function() { var jQuerytargetItem = that.slider.find('.active').next(); that.toSliderItem(jQuerytargetItem); });}var speakers = new Slideshow(jQuery('.slider-1'));}); The HTML: <div class="slider_wrap"> <div class="slider clearfix"> <div class="slide">Slide Content</div> </div> <div class="slider_controls clearfix"> <div href="#" class="slider_controls_prev"> ◄ </div> <div href="#" class="slider_controls_next"> ► </div> </div></div>
  25. I used a .js to avoid landscape view from mobile device. I edited a white full-screen image saying "this site is not thought to be viewed in landscape mode, please turn your device" to be shown each time I rotate my device from portrait to landscape. It works except when I load a page and I'm already in landscape mode. Any idea on how to fix it? Thanks <script>(function() {'use strict';var isMobile = {Android: function() {return navigator.userAgent.match(/Android/i);},BlackBerry: function() {return navigator.userAgent.match(/BlackBerry/i);},iOS: function() {return navigator.userAgent.match(/iPhone|iPad|iPod/i);},Opera: function() {return navigator.userAgent.match(/Opera Mini/i);},Windows: function() {return navigator.userAgent.match(/IEMobile/i);},any: function() {return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());}};if (isMobile.any()) {doOnOrientationChange();window.addEventListener('resize', doOnOrientationChange, 'false');}function doOnOrientationChange() {var a = document.getElementById('alert');var b = document.body;var w = b.offsetWidth;var h = b.offsetHeight;(w / h > 1) ? (a.className = 'show', b.className = 'full-body') : (a.className = 'hide', b.className = '');}})();</script> Update : I tried adding window.orientation to the script but something is wrong if (orientation === "landscape-primary") {doOnOrientationChange();window.addEventListener('resize',doOnOrientationChange,'false');}window.onload(doOnOrientationChange());
×
×
  • Create New...