Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1800 How do you control the mouse pointer?

irt.org | Knowledge Base | JavaScript | Pointer | Q1800 [ previous next ]

Q1800 How do you control the mouse pointer?

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


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.