Solved

VML Polyline problems

Posted on 2004-04-01
3
665 Views
Last Modified: 2008-01-09
Hi,

I am trying to dynamically remove some points from a VML Polyline element but can't see any way to go about doing this.

When I reference the points attribute of the line element, I find that it is a collection, so I'm able to and points to the element by simply doing:

document.all.line1.points.add(document.all.line1.points.length);
document.all.line1.points(document.all.line1.points.length - 1) = '40 40';

So now I will have a VML Polyline like:

<V:POLYLINE id="line1" onclick="" name="line1" style="POSITION: absolute;" coordsize="0,0" points="0 0 10 10 30 30 40 40" strokecolor="black" strokeweight="1pt" /></V:POLYLINE>

But I can see any way of removing any of the points, all I can do is add to the collection.

Cheers,
0
Comment
Question by:matt_pawson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 320 total points
ID: 10732775
Not exactly what you asked for, but funny result :)

<html xmlns:v="urn:schemas-microsoft-com:vml">

<head>
<style>
v\:* { behavior: url(#default#VML); }
</style>
<script>
function addPoint(){
  PL1 = document.all.line1;
  PL1.points.add(document.all.line1.points.length);
  PL1.points(PL1.points.length - 1) = PL1.points(0);
}
function delPoint(pNum){
  PL1 = document.all.line1;
  PL1.points(pNum)=PL1.points(0);

}
</script>
</head>

<body>
<!-- TOOLBAR_START --><!-- TOOLBAR_EXEMPT --><!-- TOOLBAR_END -->
</v:roundrect>
<V:POLYLINE id="line1" onclick="" name="line1" style="POSITION: absolute;" coordsize="0,0"
points="100 100 10 200 40 50 60 80" strokecolor="black" strokeweight="1pt" /></V:POLYLINE>
<form>
<input type=button value="Add" onClick="addPoint()">
<input type=button value="Dell" onClick="delPoint(2)">
</body>
</html>

0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

734 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