Jump to content

onload=focus not working


Pavlos1316

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.