Pavlos1316 Posted December 28, 2010 Share Posted December 28, 2010 Hello Since I was using frames and no javascripts the <body onLoad=document.form.name.focus();> was working. Now, on this code, whatever I do inside body tag or not, javascript or not, I cannot make it focus! Can anyone tell me what is wrong/coflicting here and what code should I use to focus? (I post none focus script here) <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>NikoCreations</title> </head> <body> <p class="text"><form action="form.php" method="post" enctype="application/x-www-form-urlencoded" name="one" id="one"> Κωδικός Πελάτη <br /> <input name="cust_code" type="text" size="7" style="text-align: center"; maxlength="7" id="cust_code" <?php if (isset($_POST['cust_code'])) { echo 'value="'.$_POST['cust_code'].'"'; } ?> /> <br /> Κωδικοί Παραγγελίας <br /> <input name="order_code" type="text" size="7" style="text-align: center"; maxlength="5" id="order_code" <?php if (isset($_POST['order_code'])) { echo 'value="'.$_POST['order_code'].'"'; } ?> /> <br /> <br /> <img src="GenerateCaptcha.php?width=150&height=35&chs=5&font=Puzzle" /> <br /> <input name="providedCaptcha" type="text" size="19" style="text-align: center"; maxlength="5" id="providedCaptchaId" /> <a href="javascript:csslinks('tow.php', 'content');"><input name="Submit" type="submit" id="button" onclick="this.form.post" value="Submit" /></a> </form></p> </body> </html> Thank you Quote Link to comment https://forums.phpfreaks.com/topic/222837-onloadfocus-not-working/ Share on other sites More sharing options...
BlueSkyIS Posted December 28, 2010 Share Posted December 28, 2010 attribute values must be quoted in HTML tags. <body onLoad='document.form.name.focus();'> beyond that, i believe your object syntax might be wrong and might should be document.getElementById('one').name.focus(); and finally, you posted a Javascript problem in the PHP forum. you might have more luck in the javascript forum. Quote Link to comment https://forums.phpfreaks.com/topic/222837-onloadfocus-not-working/#findComment-1152290 Share on other sites More sharing options...
Pavlos1316 Posted December 28, 2010 Author Share Posted December 28, 2010 really, I didn't know where to post... anyway I will just try both ways (even if I am sure I did it before) just in case. Quote Link to comment https://forums.phpfreaks.com/topic/222837-onloadfocus-not-working/#findComment-1152297 Share on other sites More sharing options...
Pavlos1316 Posted December 28, 2010 Author Share Posted December 28, 2010 Nope... none is working.... How do I move this to javascript section???? (if is the right place to ask) Quote Link to comment https://forums.phpfreaks.com/topic/222837-onloadfocus-not-working/#findComment-1152301 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.