Solved

VML Polyline problems

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
key press alert 2 32
innerHTML 7 35
Alert after MVC form submitted 1 22
Page auto-refreshes when scrolled on iPhone. 5 58
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 …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

821 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