Nick,
For IE it's not difficult using IE's vml feature.
Here's an example I wrote to draw a chart using about 50 lines of code.
It will draw a line on the chart to meet the mouse for each mouse-click.
Added complexity could have the line dynamically trail the mouse.
<html xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<style>
v\:* { behavior: url(#default#VML); }
</style>
<SCRIPT>
function loadup() {
strX = 0;
strY = parseInt(MyDiv.style.height);
window.status = 'start'
}
function DrawTo(endX,endY) {
MyLine = document.createElement("v:line")
obj = MyDiv.appendChild(MyLine)
obj.strokecolor = 'green'
obj.strokeweight = '2pt'
obj.from = strX + 'pt,' + strY + 'pt'
obj.to = endX + 'pt,' + endY + 'pt'
strX = endX;
strY = endY;
}
function getPosition(e) {
e = e || window.event;
var cursor = {x:0, y:0};
if (e.pageX || e.pageY) {
cursor.x = e.pageX;
cursor.y = e.pageY;
}
else {
cursor.x = e.clientX +
(document.documentElement.scrollLeft ||
document.body.scrollLeft)
- document.documentElement.clientLeft;
cursor.y = e.clientY +
(document.documentElement.scrollTop ||
document.body.scrollTop)
- document.documentElement.clientTop;
}
return cursor;
}
function getcursor() {
cursor = getPosition()
x = (cursor.x - MyDiv.offsetLeft) * 0.75
y = (cursor.y - MyDiv.offsetTop) * 0.75
DrawTo(x,y)
}
</SCRIPT>
</head>
<body onload="loadup();">
<!-- This v tag is how to hard code a line
<v:line id="vline" from="10pt,10pt" to="20pt,20pt" strokecolor="red"
strokeweight="2pt">
-->
<DIV id="MyDiv" style="border: 1px solid; width:600pt; height:375pt;
position: absolute; top:50px; left:100px;" onclick="getcursor()">
</DIV>
</body>
</html>
Cheers, Peter
-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Nick Arndt
Sent: Wednesday, 30 July 2008 6:19 a.m.
To: Web Enabling the AS400 / iSeries
Subject: [WEB400] using your mouse as a Magic pen on a web page
Does any one know how to use your mouse on a web page to write or draw
with?
The reason I am asking is because we would like the ability for some
people to sign their name on our online application when they have
completed it.
any help would be appreciated.
Thanks
Nick
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To
post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit:
http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.
#####################################################################################
This correspondence is for the named person's use only. It may contain confidential or legally privileged information, or both. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this correspondence in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or rely on any part of this correspondence if you are not the intended recipient. Any views expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of Veda Advantage. If you need assistance, please contact Veda Advantage on either :- Australia 133124 or New Zealand +64 9 367 6200
As an Amazon Associate we earn from qualifying purchases.