I'm having some issues trying to write a function that compares two strings from textboxes. It works fine in IE, but falls over during testing in Chrome and Firefox. I've got a sample of the code here, but I'm unsure as to the best way to make this work across browsers:
Any ideas on how I can get this function working across different browsers?Code:<html> <head> <SCRIPT language="Javascript"> <!-- function testText() { var txtContent = new String(document.getElementById(arguments[0]).value); var confContent = new String(document.getElementById(arguments[1]).value); if( txtContent.length >= 4 && txtContent.toLowerCase() == confContent.toLowerCase ) { alert('Match!'); } else { alert('No match!'); } } //--> </SCRIPT> </head> <body> <form> <input type='text' name='text1'><br /> <input type='text' name='text2'><br /> <input type='button' value='Test' OnClick="testText('text1','text2')"> </form> </body> </html>
Cheers,


Reply With Quote


Bookmarks