TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Javascript, AJAX, E4X (http://www.talkphp.com/javascript-ajax-e4x/)
-   -   Javascript not working on iPhone (http://www.talkphp.com/javascript-ajax-e4x/5103-javascript-not-working-iphone.html)

captainmerton 11-10-2009 08:49 AM

Javascript not working on iPhone
 
I've noticed the javascript on a website i'm building works fine in IE & Firefox but not on Safari on my iPhone. Any ideas how you get javascript to work on an iPhone?

ETbyrne 11-10-2009 01:59 PM

Does it work on Safari on your computer? It also helps to show what javascript you are using.

captainmerton 11-10-2009 08:46 PM

The javascript works in safari on my laptop using XP. It doesnt however work on my iphone. What i'm asking is "anybody have experience of this situation?"

In any case here's an example of some the javascript which works on safari on my laptop:

PHP Code:

function inviteFormVerifyMe(){
var 
msg='';

if(
document.getElementById('email').value==''){
    
msg+='- Email\n\n';}

if(
document.getElementById('retypeemail').value==''){
    
msg+='- Retype Email\n\n';}

if(
msg!=''){
    
alert('The following fields are empty or invalid:\n\n'+msg);
    return 
false
}else{
    return 
true }



The function is called here:

PHP Code:

        public function displayform() {
            
$yourname '';
            if (isset(
$_POST['yourname'])) {
                
$yourname $_POST['yourname'];
            }
            
$message '';
            if (isset(
$_POST['message'])) {
                
$message $_POST['message'];
            }
            
$email '';
            if (isset(
$_POST['email'])) {
                
$email $_POST['email'];
            }

            
$form '';

            
$form .= "<div id='inviteform'>";
            
$form .= "<form name='invite' action='invites.php' method='POST' enctype='application/x-www-form-urlencoded' onsubmit='return inviteFormVerifyMe();'>";
            
$form .= "<table class='invite' cellspacing='0'>";
            
$form .= $this->displayError();
            
$form .= "<tr>";
            
$form .= "<td><LABEL for='yourname' ACCESSKEY='none' >Your Real Name:</td>";
            
$form .= "<td><input type='text' name='yourname' id='yourname' size='30' maxlength='100'  value='".$yourname."'></td>";
            
$form .= "</tr>";
            
$form .= "<tr>";
            
$form .= "<td><LABEL for='message' ACCESSKEY='none' >Message:</td>";
            
$form .= "<td><textarea name='message' id='message' cols='23' rows='10' value='".$message."'></textarea></td>";
            
$form .= "</tr>";
            
$form .= "<tr>";
            
$form .= "<td><LABEL for='email' ACCESSKEY='none' ><b class='red'>*</b>Email:</td>";
            
$form .= "<td><input type='text' name='email' id='email' size='30' maxlength='100'  value='".$email."'></td>";
            
$form .= "</tr>";
            
$form .= "<tr>";
            
$form .= "<td><LABEL for='retypeemail' ACCESSKEY='none' ><b class='red'>*</b>Retype Email:</td>";
            
$form .= "<td><input type='text' name='retypeemail' id='retypeemail' size='30' maxlength='100'  value=''></td>";
            
$form .= "</tr>";
            
$form .= "<tr>";
            
$form .= "<td colspan='2' align='right'><input type='submit' name='submit' value='Send'><input type='hidden' name='token' value='".$_SESSION['token']."' /><br /></td>";
            
$form .= "</tr>";
            
$form .= "</table>";
            
$form .= "</form>";
            
$form .= "</div>";

            return 
$form;
        
        } 


sketchMedia 11-11-2009 10:54 AM

Javascript seems to work perfectly on mine, what version do you have?


All times are GMT. The time now is 07:23 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0