Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 9th, 2005, 06:06 PM
Friend of Wrox
Points: 1,107, Level: 13
Points: 1,107, Level: 13 Points: 1,107, Level: 13 Points: 1,107, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jul 2004
Location: , , .
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default replacing "alert" with a textbox

I wanted to merge 2 textboxes into 1. I put <%%> tags on the original additional textbox and its submit button. Instead I added a textbox id="t1" under the "reset".

I'm stuck on replacing the former "alert" in javascript with the "t1" textbox. There's no error showing but the textbox "t1" doesn't function.

Here's the link:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <meta name="description" content="" />
  <meta name="keywords" content="" />
  <meta http-equiv="Content-Type" content="text/html; UTF-8" />
  <meta name="author" content="" />
  <script type="text/javascript">
   //&&& 1st of 2 instances of getKeyValue(). changed name of Fx, '_h' for hebrew? 
   function getKeyValue_h(chr) { 
   //A switch statement is more efficient for this
     case "A": return 1; 
     case "B": return 2; 
     case "G": return 3; 
     case "D": return 4; 
     case "H": return 5; 
     case "V": return 6; 
     case "X": return 8; 
     case "+": return 9; 
     case "Y": return 10; 
     case "k":;
     case "K": return 20; 
     case "L": return 30; 
     case "m":;
     case "M": return 40; 
     case "n":;
     case "N": return 50; 
     case "$": return 60; 
     case "O": return 70; 
     case "p":;
     case "P": return 80; 
     case "c":;
     case "C": return 90; 
     case "q": return 100; 
     case "R": return 200; 
     case "S": return 300; 
     case "T": return 400;
     default: return 0; 

   function computeValue(str) { 
    var ans = 0; 
    for(var i = 0; i < str.length; i++) { 
     ans += getKeyValue_h(str.charAt(i));
    return ans; 
function Process(){
  var frm = document.getElementById("form1");
  var x = Number(frm.hOutput.value);
  var remainder = (x % 22);
  if (remainder==0) {remainder=22;}
  alert("( " + x + " % 22 ) = SPOKE " + remainder) 
  <style type="text/css">
<%'<form id="form1" action="" onsubmit="">
'Enter a number to determine which SPOKE it belongs to:
'    <input type="text" name="t1"/>
'    <input type="button" value="SPOKE" onclick="Process()"/>
  <form id="form1" action="javascript:void(0)">
    <textarea          name="hInput"  id="hInput"  onkeyup="hOutput.value = computeValue(hInput.value, 'h');" rows="9" cols="64" class="onLoad"></textarea><br />
    <input type="reset" value="Clear" name="B2" />
    <input type="text" name="hOutput" id="hOutput" onkeyup="t1.value = Process()" class="onLoad"/>
    <input type="text" name="t1" id="t1" readonly="true"/>
Learning of our true origins.

I feel sorry:


Foreknowledge of A Natural Disaster
Washington was aware that a deadly Tidal Wave was building up in the Indian Ocean
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help replacing pannels MacDevv C# 0 August 14th, 2006 04:35 AM
Replacing a character from string itHighway Classic ASP Basics 5 March 14th, 2005 11:15 PM
Replacing nbsp delinear Javascript 2 February 5th, 2005 12:22 PM
Replacing tabel civa Access VBA 1 January 24th, 2005 08:41 AM

All times are GMT -4. The time now is 08:57 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.