Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

input values are truncated

Status
Not open for further replies.

Geates

Programmer
Aug 25, 2009
1,566
US
I provided a solution for a VBS thread regarding fraction simplification - thread329-1697266. The solution accepts two values and simplies them as if they were the nominator and the denominator; works beautifully when run as a VBS. However, when implemented into an HTML, the values are read properly but processed in a truncated form. What gives!?

Example
A: 5 B: 25, read as 5 and 25 but processed as 5 and 2
A: 11 B: 4, read as 11 and 4 but processed as 1 and 4
A: 4867 B: 7, read as 4867 and 7 but processed as 4 and 7

You can see how this can present a HUGE problem. Here is a simplified cut/paste ready instance that demostrates the "error"

Code:
<html>
	<script language="vbscript"> 
		sub process()
			a = txt1.value
			b = txt2.value
			if (a > b) then
				msgbox "Apple"
			else
				msgbox "Banana"
			end if
		end sub
	</script> 
	
	A: <input id="txt1" type="text" value=""/><br>
	B: <input id="txt2" type="text" value=""/><br>

	<input type="button" value="Simplify Fraction" onClick="process()"/>
</html>

-Geates

 

Hint: String value "7" is greater than string value "4867"



Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top