Solved

VML Polyline problems

Posted on 2004-04-01
3
661 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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…

760 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

25 Experts available now in Live!

Get 1:1 Help Now