我做了一个flash网站上的联系表单,这完美的作品在Firefox,IE和Chrome在我的电脑。 然而,在Safari我似乎无法在任何文本框输入; 而在Android上,我sowehow只能输入大写字母(基本的CapsLock是,它不会让我改变为小写)。
我怀疑这个问题完全在于在Flash中,因为发送电子邮件确实工作得很好。 搜索这里或谷歌没有得到我任何有关。
有小费吗?
这里是我的代码:
FormScript.as(这是从我的主。作为文件称为外部。至于文件)
//***All imports, vars, etc***
function submit(e:MouseEvent):void {
//Check to see if any of the fields are empty
if(yourName.text == "" || fromEmail.text == "" ||
yourSubject.text == "" ||yourMsg.text == "" ) {
valid.text = "All fields must be filled";
}
//Check if you're using a valid email address
else if(!checkEmail(fromEmail.text)) {
valid.text = "Please fill in an existing email";
}
else {
valid.text = "Verzenden..";
var emailData:String =
"name=" + yourName.text +
"&from=" + fromEmail.text +
"&subject=" + yourSubject.text +
"&msg=" + yourMsg.text;
var urlVars:URLVariables = new URLVariables(emailData);
urlVars.dataFormat = URLLoaderDataFormat.TEXT;
urlRequest.data = urlVars; varLoad.load( urlRequest );
varLoad.addEventListener(Event.COMPLETE, thankYou );
}
}
function reset(e:MouseEvent):void {
init(); //call the initial clear function
}
function checkEmail(s:String):Boolean {
//This tests for correct email address
var p:RegExp = /(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/;
var r:Object = p.exec(s);
if( r == null ) {
return false;
}
return true;
}
function thankYou(e:Event):void {
var loader:URLLoader = URLLoader(e.target);
var sent = new URLVariables(loader.data).sentStatus;
if( sent == "yes" ) {
valid.text = "Thanks for your email!"; timer = new Timer(500);
timer.addEventListener(TimerEvent.TIMER, msgSent);
timer.start();
}
else {
valid.text = "Something went wrong, please try again";
}
}
function msgSent(te:TimerEvent):void {
if(timer.currentCount >= 10) {
init();
timer.removeEventListener(TimerEvent.TIMER, msgSent);
}
邮件处理PHP文件:
<?php
$yourName = $_POST['name'];
$fromEmail = $_POST['from'];
$yourSubject = $_POST['subject'];
$yourMsg = $_POST['msg'];
if( $yourName == true ) {
$sender = $fromEmail;
$yourEmail ="myemailaddress@example.com"; // Naturally I put in my own email address here :)
$ipAddress = $_SERVER['REMOTE_ADDR']; // This gets the user's ip Address
$emailMsg = "Van: $sender\r\n" .
"Naam: $yourName\r" .
"Subject: my site - $yourSubject\n\n" .
"$yourMsg\n\n\n\n" .
"------------------------------\r" .
"Verstuurd vanaf IP-adres $ipAddress\r" .
"X-Mailer: PHP/" . phpversion();
$return = "From: $sender\r\n";
if( mail( $yourEmail, "$yourSubject", $emailMsg, $return)) {
echo "sentStatus=yes";
}
else {
echo "sentStatus=no";
}
}
?>
编辑:
我设法解决这个Android的问题。 Safari浏览器仍然不会让我的类型。
我改变了标题- 原题:“在Android上的Flash形式让我只键入大写字母/ CAPS,狩猎不会让我在所有类型”
这可能确实为Android的伎俩的部分是设置文本框成为.htmlText
代替.text
在AS3代码。