Jump to content

Search the Community

Showing results for tags 'javascrip'.



More search options

  • 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

Found 5 results

  1. Hi, Im trying to subtract 3 from the value If the radio button is checked. However, its not working. <script type="text/javascript"> function calcShipping() { var txtWeight, pound1, pound2, pound3, freq, notfreq, freq1; var values = " "; freq1 = 3; pound1 = 5; pound2 = 10; pound3 = 15; txWeight = document.getElementById("txtWeight").value; txWeight=parseInt(txWeight); if (txWeight < 1) {document.write("Your cost is " + pound1 + "$.") }; if (txWeight >= 1 & txWeight < 3) {document.write("Your cost is " + pound2 + "$.") }; if (txWeight >= 3 & txWeight <= 5) {document.write("Your cost is " + pound3 + "$.") }; if (document.getElementById("freq").checked = true){ document.write(" Your cost is " + (txtWeight.result - freq1) + "$."); } else if (document.getElementById("notfreq").checked){ document.write("Your cost is " + (txtWeight.value) + "$."); } } </script>
  2. Hello, I started learning JavaScript this week and I've been mostly using the JavaScript tutorial. It's been great, thanks a lot to all the authors! However, unless I'm mistaken and still don't fully understand, there is some information that I think is wrong or misleading about variable scopes. It prevented me from understanding closures until I worked through other people's code about main loops and did some testing. On the Function Closures page, it says: "Local variables have short lives. They are created when the function is invoked, and deleted when the function is finished." And on the Scope page, it says something similar: "Local variables are deleted when the function is completed." But a local variable is not deleted when the function is completed if there is a reference to it left somewhere outside the function. Of course, normally, there are no references to local variables left outside a function so the local variables are deleted upon exit. But when we declare a local subfunction that access a local variable and then give this subfunction to an outside object, so long as the outside object exist, the local variable of the original function will not be deleted either because it can still be accessed. I think this exception should be mentioned on both pages to help beginners (like me) understand how a local variable can still be accessed after the function is was declared in has been completed. I have some prior experience in C and VBA and I find the scopes of variables in JavaScript to be very different (probably due to not having a way of passing non-object variable references in function arguments). Or maybe I'm wrong, in which case I would be grateful if someone can explain it to me further. Thanks Terence
  3. I want do to a simple thing : I have a two scrolls website, and I want to hide the right part when the scroll is at the maximum on the right part. SO I used document.onscroll = function() { if (window.innerHeight + window.scrollY > document.body.offsetHeigh... but the right part is hidden when the scroll is at his max on left part. How Can I do ? the code pen with the precise problem : https://codepen.io/marie-fran-oise-talbot/pen/LKeqBE thank youuuuu
  4. Im am trying to assign the function of my dropdown menu so when you click on the selected county it will focue on that countie. I have written out what I can below, through research as I am new to all this, but am not sure how to link it all together. I know I haven't got the googlemaps attached but I do in my full page, it is just this section i am having trouble in trying to link together. <!doctype html> <html> <head> <script type="text/javascript"> document.getElementById('counties').addEventListener('click', function(e) {alert(this.value); e.preventDefault();}, false); $('bedfordshire').click(function(){ alert(this.value); }); $('buckinghamshire').click(function(){ alert(this.value); }); $('cambridgeshire').click(function(){ alert(this.value); }); $('hertfordshire').click(function(){ alert(this.value); }); $('northamptonshire').click(function(){ alert(this.value); }); //bedfordshire bounds = new google.maps.LatLngBounds(); bounds.extend(new google.maps.LatLng(52.33, -0.05)); bounds.extend(new google.maps.LatLng(51.8, -0.8)); map.fitBounds(bounds); //buckinghamshire bounds = new google.maps.LatLngBounds(); bounds.extend(new google.maps.LatLng(52.21, -0.33)); bounds.extend(new google.maps.LatLng(51.47, -1.33)); map.fitBounds(bounds); //cambridgeshire bounds = new google.maps.LatLngBounds(); bounds.extend(new google.maps.LatLng(52.75, -0.55)); bounds.extend(new google.maps.LatLng(51.99, -0.53)); map.fitBounds(bounds); //hertfordshire bounds = new google.maps.LatLngBounds(); bounds.extend(new google.maps.LatLng(52.09, -0.35)); bounds.extend(new google.maps.LatLng(51.59, -0.80)); map.fitBounds(bounds); //northamptonshire bounds = new google.maps.LatLngBounds(); bounds.extend(new google.maps.LatLng(52.67, -0.33)); bounds.extend(new google.maps.LatLng(51.94, -1.35)); map.fitBounds(bounds); </script> </head> <body> <select id="Counties" > <option value="">Select County</option> <option value="bedfordshire">Bedfordshire</option> <option value="buckinghamshire">Buckinghamshire</option> <option value="cambridgeshire">Cambridgeshire</option> <option value="hertfordshire">Hertfordshire</option> <option value="northamptonshire">Northamptonshire</option> </select> </body> </html>
  5. Hi w3 Community i want to learn how to replicate this effect on the main screen of this website https://overv.io/ The traget(booklets) starts off somewhere fixed and translate/rotates towards 0 once it's reached it's original location, scrolling further down won't change any location scrolling back up with move the items back towards the location it stated. Here's something which i think it should look like.. window.onscroll = function() {var speed = 1; //this should be adapted to the height of divvar startdeg = 130; //var startx = 300;var starty =-300;var scroll = $(window).scrollTop(); //using scrolling as variablevar deg = (startdeg - scroll) / speed;var translatex = startx - scroll/ speed;var translatey = starty - scroll/ speed;//Here should be some conditioner or maybe a do-while loop to stop transforming once it reached it's original location?$(".logo").css({"transform": "translate("translatex+"px,"translatey+"px) rotate("+deg+"deg)",}); }; https://jsfiddle.net/aavelyn/ktccxr6j/1/ PS: I'm fairly basic with javascript,jquery though i can fully understand the code presented. Thanks a lot!!
×
×
  • Create New...