Jump to content

rgrisham

Members
  • Posts

    8
  • Joined

  • Last visited

rgrisham's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Thanks, you've been very helpful. I am interested in creating js files, and understanding the process. I will considered your advice on smaller project because right now I'm just getting my feet wet. However, I did enjoy making the .css files for this project, which I've not listed here. I have several different projects and just recently hit a couple big snags. Again thanks
  2. Here is code that was in the w3schools tutorial. How would you write it for a .js file? I thought you could just cut and paste this code directly into the .js file. I split them up into my with the function one in js file, and the other in the html body. I know that wrong, but I couldn't find another way to do it. I added the date and locate functions later.. as I had it things worked even though I knew it was bad code, but I was just interested in understand things first. Then clean it up later.. It wasn't until I added the locate function that things got really screwy, and I could not figure out how to correct it or function correctly. I have ran into a lot of little hiccups, but so far, I've figure them out. But, I figure getting the js files coded correctly will help me tremendously. JavaScript Functions section of the tutorial <script>document.getElementById("demo").innerHTML ="The temperature is " + toCelsius(32) + " Centigrade"; function toCelsius(fahrenheit) { return (5/9) * (fahrenheit-32);}</script> ​
  3. this is the html ( I would've saved this in the box like you but couldn't figure it out. <!DOCTYPE html><html><head><link rel="stylesheet" type="text/css" href="Style.css"></head><body><h1>Howard Zinn</h1><p>A Peope History of the United States of America</p><p id="demo">A Paragraph.</p><script src="Jscript.js"></script><button type="button" onclick="myFunction()">Try it</button><p id="bark"></p><script>document.getElementById("bark").innerHTML ="The temperature is " + toCelsius(32) + " Centigrade";</script><br><button onclick="displayDate()">The time is?</button><p id="######"></p><br><br><p id="p1">Please find locate where 'locate' occurs!.</p><button onclick="myFunction()">Push it</button><p id="cat"></p></body></html> Here is the js.file function myFunction() { document.getElementById("demo").innerHTML = "Paragraph changed."; }function toCelsius(fahrenheit) { return (5/9) * (fahrenheit+40);}function displayDate() { document.getElementById("######").innerHTML = Date();}function myFunction() { var str = document.getElementById("p1").innerHTML; var pos = str.indexOf("locate"); document.getElementById("cat").innerHTML = pos;} Does that help​ ​
  4. Please forgive me, I'm new at this and old, so the going is slow. 1. If you place multiple functions in .js file, can a functions overwrite or negate other functions? If so, is there special designation that need to be placed in .js file. I'm having trouble with functions not working on the webpage like buttons not working correctly after adding a another function. (I'm not on a live webpage - just learning) 2. Are js files exclusively for functions? Can other things be placed in a .js file besides code that start with function because I've tried other things like example below and could not get them to work in the .js file. example: document.getElementById("bark").innerHTML ="The temperature is " + toCelsius(32) + " Centigrade";​ I had to post that directly in to the body to work. This example is from the tutorial. Any help would be appreciated thanks
  5. rgrisham

    Background CSS3

    Figured it out.. My problem was the file name.. The file was two words and I had a blank space between them... I add _ between them and the image displayed correctly as the background. Thanks
  6. rgrisham

    Animation ?

    I think I misunderstood the toturial. I was expecting the images to move in CSS3 2D toturial. Thanks
  7. rgrisham

    Animation ?

    Started on the 2D tutorial and could not get animation to work - IS this explained further along in the animation section of CSS3? Or, is animation in JavaScript? I was hoping it wasn't a computer setting problem because when I was in the CSS3 2D transformation tutorial, the animation was not working. Thanks Rich
  8. rgrisham

    Background CSS3

    html { background: url(img_flower.jpg) no-repeat center center fixed; background-size: cover;} I've put the above CSS3 in stylesheet and into the html doc directly on my laptop, which was displaying the img background using CSS, but I could not get a background using CSS3. I am running Windows 10. Is there a setting on the computer or a limit to an image? I was a jpg img. In addition, I used this same code on another computer and it worked perfectly. Different image and doc, but I've checked it thoroughly for errors in script, but haven't noticed any obvious difference. Anyway help would be greatly appreciated. Thanks Rich
×
×
  • Create New...