Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VML Polyline problems

Posted on 2004-04-01
3
Medium Priority
?
667 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 1280 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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

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…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

715 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