Jump to content

Search the Community

Showing results for tags 'maths'.

  • 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








Found 2 results

  1. Hi there. I am building a website that has its body centered in the page and it's width is exactly 768 px. I want right on it's left (and touching it) a menu that will always stay on screen while scrolling down. Here's how I thought to do: The body's css (in fact in my code a <div> with id="canvas"): #canvas { float : auto ; margin-left: auto ; margin-right: auto ; top : 100% ; bottom : 100% ; width : 768px ; } And my menu <div id="floatMenu">: #floatMenu { position : fixed ; width : 64px ;} Now, in order to keep this menu always exactly on the left of the "canvas", I came up with a simple formula which is: 50% - (768 / 2)px - (64)px (see image attached) * 50% is the center of the browser's window * (768/2) is half of the canvas' width * 64 is the width of the floatMenu itself My question is: would it be possible to code this formula in CSS? And if not, I'm open to any suggestions to position my menu the way I want it. Thanks in advance for reading! Thomas
  2. Hello,I am on a steep learning curve, and am trying to add some JavaScript to an existing set of functions which are working well. Any help would be very much appreciated!Essentially we have a set of functions which check a number of values and either display/sum them. We need to add a second span next to all of the existing "days" spans to calculate the days in years (i.e. divide by 365.25).My new sections are named the same as the existing sections, but have "Years" on the end of the id - e.g. valueCurrentDuration becomes valueCurrentDurationYears. When I add studyDuration("underPost","valueUnderPostDurationYears"); into the studyDurationAll function, the value displays correctly. When I try to divide this by 365.25, it fails. I have tried a number of different ways of doing this and have not had any luck. The existing JS is as below:<script type="text/javascript">window.onload = studyDurationAll;function studyDurationAll() { studyDuration("current","valueCurrentDuration"); studyDuration("preDegree","valuePreDegreeDuration"); studyDuration("underPost","valueUnderPostDuration"); studyDuration("doctoral","valueDoctoralDuration"); totalStudyDuration();}function studyDuration(section,display) { if (document.getElementById(section)) { var spanArray = document.getElementById(section).getElementsByTagName("span"); var totalStudyDuration = Number(0); for(i = 0; i < spanArray.length; i++){ totalStudyDuration = totalStudyDuration + Number(spanArray.innerHTML); } if (document.getElementById(display)){ var sectionTotal = document.getElementById(display) sectionTotal.innerHTML = totalStudyDuration; } }}function totalStudyDuration(){ var totalStudyDuration = document.getElementById("valueTotalStudyDuration"); if (document.getElementById("valueCurrentDuration")) { var valueCurrentDuration = document.getElementById("valueCurrentDuration").innerHTML; } else { var valueCurrentDuration = 0 } if (document.getElementById("valuePreDegreeDuration")) { var valuePreDegreeDuration = document.getElementById("valuePreDegreeDuration").innerHTML; } else { var valuePreDegreeDuration = 0 } if (document.getElementById("valueUnderPostDuration")) { var valueUnderPostDuration = document.getElementById("valueUnderPostDuration").innerHTML; } else { var valueUnderPostDuration = 0 } if (document.getElementById("valueDoctoralDuration")) { var valueDoctoralDuration = document.getElementById("valueDoctoralDuration").innerHTML; } else { var valueDoctoralDuration = 0 } totalStudyDuration.innerHTML = Number(valueCurrentDuration) + Number(valuePreDegreeDuration) + Number(valueUnderPostDuration) + Number(valueDoctoralDuration); var totalPreDegreeDuration = document.getElementById("valueTotalPreDegreeDuration"); totalPreDegreeDuration.innerHTML = valuePreDegreeDuration;}</script>I would be so grateful for any help.Thank you! C
  • Create New...