Solved

VML Polyline problems

Posted on 2004-04-01
3
662 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now