Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1800 How do you control the mouse pointer?

You are here: irt.org | FAQ | JavaScript | Pointer | Q1800 [ previous next ]

This is a clear piece of HTML and JavaScript which teaches you how to control your mouse pointer

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000" OnMouseMove='Showit()'>
<script language="JavaScript"><!--
function setPointer(method) {
  document.myForm.textfield.value=document.myForm.mySelect.options[document.myForm.mySelect.selectedIndex].text;
  if (document.all) {
    document.body.style.cursor = document.myForm.mySelect.options[document.myForm.mySelect.selectedIndex].text;
  }
}

function customsetpointer() {
  if (document.myForm.checkbox.checked) {
    window.alert("mousepointer is being set to: " + document.myForm.textfield.value);
  }
  if (document.all) {
    document.body.style.cursor = document.myForm.textfield.value;
  }
}
//--></script>

This is some normal text
<a href="apage.html" id="myLink">hyper link text</a>
and some normal text.

<form NAME="myForm">
  <p> Set mousepointer to:
    <select name="mySelect" onChange="setPointer()">
      <option>auto
      <option>crosshair
      <option>default
      <option>hand
      <option>move
      <option>e-resize
      <option>ne-resize
      <option>nw-resize
      <option>n-resize
      <option>se-resize
      <option>sw-resize
      <option>s-resize
      <option>w-resize
      <option>text
      <option>wait
      <option>help
    </select>
  </p>
  <p>Set pointer manually to:
    <input type="text" name="textfield">
    <input type="button" name="Button" value="Change Pointer" onClick="customsetpointer()">
    <br>
    Echo back setting
    <input type="checkbox" name="checkbox" value="checkbox" checked>
  </p>
</form>

<p>Edited by FreeLa/\/Cer (the_king17@hotmail.com) using DreamWeaver ;-)</p>
</body>
</html>

Submitted by FreeLa/\/Cer

©2018 Martin Webb