|
-
Mar 9th, 2005, 05:07 PM
#1
Thread Starter
Hyperactive Member
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:
http://k.domaindlx.com/gemetria/gemetria3.asp
Code:
<%
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<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">
//<![CDATA[
//&&& 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
switch(chr.charAt()){
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)
}
//]]>
</script>
<style type="text/css">
/*<![CDATA[*/
textarea{font-family:BSTHebrew}
/*]]>*/
</style>
</head>
<body>
<body>
<%'<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>%>
<form id="form1" action="javascript:void(0)">
<div>
<br>
<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"/>
</div>
</form>
</body>
</html>
-
Mar 10th, 2005, 11:50 AM
#2
Fanatic Member
Re: replacing "alert" with a textbox
Have you tried removing readonly="true"?
-
Mar 10th, 2005, 02:41 PM
#3
Thread Starter
Hyperactive Member
Re: replacing "alert" with a textbox
Yes I tried and didn't work. But isn't there supposed to be a javascript function to imediately show the result in the 2nd textbox?
-
Mar 11th, 2005, 01:21 AM
#4
Re: replacing "alert" with a textbox
PHP Code:
document.formname.textbox2name.value = //the value
-
Mar 11th, 2005, 01:39 AM
#5
Thread Starter
Hyperactive Member
Re: replacing "alert" with a textbox
Code:
document.formname.textbox2name.value = //the value
SO I take it that this goes in JavaScript replacing the "alert" right?
-
Mar 11th, 2005, 01:44 AM
#6
Re: replacing "alert" with a textbox
Well, you'd use it to place a value into your second textbox.
-
Mar 11th, 2005, 01:59 AM
#7
Thread Starter
Hyperactive Member
Re: replacing "alert" with a textbox
Code:
function Process(){
var frm = document.getElementById("form1");
var x = Number(frm.hOutput.value);
var remainder = (x % 22);
if (remainder==0) {remainder=22;}
document.form1.t1.value = "( " + x + " % 22 ) = SPOKE " + remainder;
} //]]>
I must be doing something wrong. It Doesn't work.
Code:
<span DIR=rtl><textarea name="hInput" id="hInput" onkeyup="hOutput.value = computeValue(hInput.value, 'h');" rows="9" cols="64" class="onLoad">
</textarea></span><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"/>
<input type="submit" value=" Search "/>
-
Mar 11th, 2005, 02:08 AM
#8
Re: replacing "alert" with a textbox
Odd, at first glance it seems OK.
Code:
function Process(){
var frm = document.getElementById("form1");
var x = Number(frm.hOutput.value);
var remainder = (x % 22);
if(remainder==0) {
remainder=22;
}
frm.t1.value = 'testing';
}
Does testing show up at all? Is this on the URL you specified?
-
Mar 11th, 2005, 05:35 AM
#9
Thread Starter
Hyperactive Member
Re: replacing "alert" with a textbox
Ok since it is found on the "response" page go to URL:
http://k.domaindlx.com/gemetria/kjv.asp
TO make it easy to get there go to the textbox where it says "select a checkbox below to enable".
Check "book" and type 1 in the textbox to search for book '1'.
Then You find the textarea with two textoxes.
WHen you type, to make it easy use capital letters in the textarea.
You'll notice "BRASYT" will show 912 but the textbox next to it stays empty.
Here's the script:
Code:
//<![CDATA[
//&&& 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
switch(chr.charAt()){
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":;
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;
}
frm.t1.value = 'testing';
} //]]>
-
Mar 11th, 2005, 05:43 AM
#10
Re: replacing "alert" with a textbox
-
Mar 11th, 2005, 05:46 AM
#11
Thread Starter
Hyperactive Member
Re: replacing "alert" with a textbox
If you got this:
SELECT * FROM 2 WHERE book LIKE '1' ORDER BY id ASC
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/gemetria/kjvresp5.asp, line 212
then refresh
End if
-
Mar 11th, 2005, 06:32 AM
#12
Re: replacing "alert" with a textbox
This is the message:
SELECT * FROM 2 WHERE text_data LIKE '%1%' AND text_data LIKE '%1%' AND book LIKE '' ORDER BY id ASC
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/gemetria/kjvresp5.asp, line 215
2 obviously isn't supposed to be the tablename, is it?
-
Mar 11th, 2005, 09:34 AM
#13
Thread Starter
Hyperactive Member
Re: replacing "alert" with a textbox
It doesn't work because the text_data LIKE '%1%' is for text. You don't have to put any word there though.
-
Mar 11th, 2005, 10:37 PM
#14
Thread Starter
Hyperactive Member
Re: replacing "alert" with a textbox
I just notice that when:
1. I write in the textarea the first textbox gives the sum of the numerical value of each letter automatically but the second textbox doesn't pick up the sum (the purpose of the 2nd textbox is to divide the sum of the 1st textbox and give the remainder).
2. I type any key in the 1st textbox it says "undefined".
So I think there are a few things:
1. the 2nd textbox doesn't pick up automatically from the first;
2. there is a defintition missing.
-
Mar 13th, 2005, 12:59 AM
#15
Re: replacing "alert" with a textbox
I just can't get past that page you linked to. I feel like an obsessed, forlorn lover now.
-
Mar 13th, 2005, 10:22 AM
#16
Thread Starter
Hyperactive Member
Re: replacing "alert" with a textbox
-
Mar 13th, 2005, 12:29 PM
#17
Re: replacing "alert" with a textbox
I think I got it.
Change this:
Code:
<input type="text" name="hOutput" id="hOutput" onkeyup="t1.value = Process()" class="onLoad"/>
to this:
Code:
<input type="text" name="hOutput" id="hOutput" onChange="t1.value = Process();" class="onLoad"/>
Is that what you wanted?
-
Mar 13th, 2005, 01:23 PM
#18
Thread Starter
Hyperactive Member
Re: replacing "alert" with a textbox
textbox 1 isn't transferring to textbox 2.
Textbox 2 no longer says undefined when I type in textbox 1 though (I think that's a good sign).
This should resemble to a combo listbox, where you select from the 1st listbox a list appears in the 2nd and after that selection then the 3rd. Except they are 1 textarea and 2 textboxes.
Is this ok though?
Code:
function Process(){
var frm = document.getElementById("form1");
var x = Number(frm.hOutput.value);
var remainder = (x % 22);
if(remainder==0) {
remainder=22;
}
frm.t1.value = 'testing';
}
-
Mar 14th, 2005, 01:18 AM
#19
Re: replacing "alert" with a textbox
Apparently the onChange event isn't being fired.
use this:
Code:
function Process(){
var frm = document.getElementById("form1");
var x = Number(frm.hOutput.value);
var remainder = (x % 22);
if(remainder==0)
{
remainder=22;
}
return remainder;
}
Code:
<span dir="rtl"><textarea name="hInput" id="hInput" onkeyup="hOutput.value = computeValue(hInput.value, 'h'); t1.value=Process();" rows="9" cols="64" class="onLoad" title="An easy way to paste some text from the list below, select the text, drag it to this text area and then press SHIFT"></textarea></span><br>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|