Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8112719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:35:59+00:00 2026-06-06T02:35:59+00:00

i had a problem on confusing how to put ontouch inside my coding because

  • 0

i had a problem on confusing how to put ontouch inside my coding because i want it function on ipad, below is my code

    <script language="javascript">
function sig1()
{
    if(sig == null)
    {
        xclear('myCanvas');
    }
}

code for clear the line in canvas

<body id="main_body" class="no_guidelines" onload="sig1()" onmouseup="bodyonmouseup">

to let the canvas had fillstyle color and function

<canvas border=1 id="myCanvas" height=200 width=400 onmousedown="onmousedown()" onmouseup="onmouseup()" onmousemove="onmousemove()">Your browser does not support the application</canvas>

canvas that can draw line like signature

var sig = null;
      var ele;
      function bodyonmouseup(e)
{
    var ele;
    ele = document.getElementById('myCanvas');
    ele.isDown = false;
}
function onmousedown(e)
{
    var ele,p;
    if (!e) e = window.event;
    ele = (e.srcElement);
    if (! ele) ele = e.target;
    ele.isDown = true; 
    ele.context = ele.getContext("2d");
    ele.context.lineWidth = 1;
    ele.context.beginPath();   
    ele.context.moveTo(e.offsetX,e.offsetY);
    sig.line = new Array();

    p = new Object();
    p.x = e.offsetX;
    p.y = e.offsetY;

    sig.p = p;
    sig.line[sig.line.length] = p;
    sig.lines[sig.lines.length] = sig.line;
}
function onmousemove(e)
{
    var ele,dx,dy,p;
    if (!e) e = window.event;
    ele = (e.srcElement);
    if (! ele) ele = e.target;
    if (! ele.isDown) return;
    ele.context.lineTo(e.offsetX,e.offsetY);
    ele.context.stroke();
    dx = e.offsetX - sig.p.x;
    dy = e.offsetY - sig.p.y;
    if (dx == 0 && dy == 0) return;
    sig.p = new Object();
    sig.p.x = e.offsetX;
    sig.p.y = e.offsetY;
    sig.line[sig.line.length] = sig.p;
}

So i want to know if i want keep both onMouse and ontouch, how i put the ontouch so that the canvas can be draw on ipad?? please help, it is urgent

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:36:02+00:00Added an answer on June 6, 2026 at 2:36 am

    Use this js. Your finger will be your mouse. They are converting all touch events to mouse events.

    jquery-ui-touch-punch

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ACL seems to be very confusing and never problem-free. Although, I've had no major
I had no problem at all running the following code on a local server,
Sorry about the confusing title, I had a hard time describing the problem. I
I have the same problem others have had, but I can't get my code
Had a problem with the recursive conflictCheck() method. That seems fine now. I have
I had this problem before and can't for life of me remember how to
I had a problem where I had a series of overlapping CATransition / CAAnimation
I had a problem with set not working in a batch file; it took
I had this problem some time ago and I gave up but lately it
I had a problem in site map path I had navigation bar which take

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.