[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Problem changing VML line color in JavaScript

Posted on 2007-09-29
1
Medium Priority
?
673 Views
Last Modified: 2008-01-09
I'm trying to learn basic JavaScript and also teach myself a bit about VML.  I want to learn how to modify line variables in JavaScript, but my code does not seem to work (probably a basic syntax problem).  Can someone take a look at this and let me know what is wrong?  The JavaScript should change the color of the line to blue instead of green.

<html>
  <head>
    <xml:namespace ns="urn:schemas-microsoft-com:vml" prefix="v"/>

    <style type="text/css">
      v\:* { behavior: url(#default#VML);}
    </style>

<script language="javascript">
<!--

function changeline()
{
  document.section1.line1.strokecolor="#0000FF";
}

//-->
</script>

  </head>

  <body onLoad=changeline()>

    <?xml:namespace prefix = v />

    <v:line
      from="0 6"
      to="100 106"
      id=line1
      href="http://www.yahoo.com"
      target=yahoo
      class=null
      title="Yahoo"
      alt="www.Yahoo.com"
      style='position:absolute;'
      opacity="1.0"
      chromakey="null"
      strokecolor="#FF0000"
      strokeweight="3"
    />

</body>
</html>
0
Comment
Question by:Tim Titus
1 Comment
 
LVL 23

Accepted Solution

by:
basicinstinct earned 500 total points
ID: 19985206
try changing this:
document.section1.line1.strokecolor="#0000FF";

to this:
document.getElementById('line1').strokecolor="#0000FF";
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question