Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

changing css with javascript


  • Please log in to reply
3 replies to this topic

#1 BillyShope

BillyShope

  • Members
  • 4 posts
  • OFFLINE
  •  
  • Local time:03:22 AM

Posted 16 September 2014 - 09:24 AM

Can't change css3 border-radius with javascript (unlike width, height, etc.). I want to transition a square to a circle. I'm using Firefox.



BC AdBot (Login to Remove)

 


m

#2 BillyShope

BillyShope
  • Topic Starter

  • Members
  • 4 posts
  • OFFLINE
  •  
  • Local time:03:22 AM

Posted 16 September 2014 - 12:52 PM

The following code works.

 

<!doctype html>

<html>

<head>

<style>

#george{

    width:400px;

    height:400px;

    border-style:solid;

    border-width;1px;

    border-radius:0px;

</style>

<script>

    function changer(){

    document.getElementById("george").style.width="200px";

</script>

<body onload="changer()">

<div id="george"></div>

</body>

</html>

 

But, if I substitute "...border-radius='100px'" for "...width='200px'," it does not work. Why?

 



#3 BillyShope

BillyShope
  • Topic Starter

  • Members
  • 4 posts
  • OFFLINE
  •  
  • Local time:03:22 AM

Posted 16 September 2014 - 03:33 PM

It's "borderRadius" in Javascript. Sorry. It took me a while to find this..



#4 BillyShope

BillyShope
  • Topic Starter

  • Members
  • 4 posts
  • OFFLINE
  •  
  • Local time:03:22 AM

Posted 16 September 2014 - 03:48 PM

But, it must be "border-radius" in the transition statement (if you use one), though it's still in javascript.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users