473,320 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Cursor landing / position

18
Hello, and thank-you for reading this. I have used the the advanced serach functions to see if my question has already been addressed, but I get no results.

My search was in PHP forums for:

cursor landing & cursor position

What I need to do is to have the cursor "land" into the username entry box when one visits the site to log in please?

Thank-you all in advance,

jim
Oct 24 '08 #1
7 1669
code green
1,726 Expert 1GB
Can't give an exact example, but to help your research you need the onLoad() function and the focus command.
It is something like [PHP]<body onLoad="document.id.focus()">[/PHP]
Oct 24 '08 #2
Markus
6,050 Expert 4TB
PHP can't control this. I'm not sure if javascript can, either. But this question is more relevant to JS.

--Moving to JS
Oct 24 '08 #3
acoder
16,027 Expert Mod 8TB
The word to search for is "focus". Code green was along the right lines, though it would probably result in errors. You can use something like:
Expand|Select|Wrap|Line Numbers
  1. <body onload="document.getElementById('idOfElement').focus();">
Oct 25 '08 #4
trochia
18
First of all, I would like to thank all three of you for the replies so far.

And I am sorry for my late one, but I never got an e-mail notify of a reply, and I think the below is why...and mabe the "coders" of the forums, could fix this?

code_green, thank-you for the intial direction, but I didn't get back to the forums here until today.

Markus? Sorry about tossing into the php forum, and thx for moving it...but it seems once it got moved, the "subscribe flagging" got lost. As this also happened in my very first post on bytes a few weeks ago, when you moved one.

Just thought I'd mention that...so thank's again.

Now, to the nitty - gritty I have been staring at for the past hour on and off since reading this.

The first thing I did was to do a local disk search on my box here to see if I anything containing the phrase
body onLoad
in which I knew I would find a few.

Now, acoder, I thank-you VERY much for the goal I need to obtain, but here is where I am stuck trying to figure this out, and where to place it.

The first "instance" of it I had, was in an index.php file, (one of which I am not using nor worried about at this moment and has NOTHING to do with the code I am trying to modify...a whole nother set of scripts), but thought it could explain to me by reading it coming after /head and goes like this:
[PHP]
</head>

<body onload="document.whois.domain.focus();">
<h5>Search for a domain</h5>
<form action="" name="whois" id="whois">
<label for="domain">domain:</label>
<input type="text" name="domain" id="domain" onkeyup="checkDomain()" />
<div id="result"></div>
</form>
[/PHP]

My html form, is where I would suspect I need to place this, and it looks like this: It is called example.html and it is plulled from another file (index.php)

[php]$out = implode("\n", file('example.html'));[/php]

In which a function I haven't even played with yet, so I am not sure if I am looking in the right place?

[PHP]
<table>
<tr><td bgcolor="#55aaff">
<form method="get" action="{self}">

<table>
<tr><td colspan=2>
<center>
<b> Welcome to my Whois is lookup routine</b><br>
<b>Enter any domain name, ip address or <br> AS handle you would like to query whois for</b>
<br></br>
<input name="query"></input> <input type="submit" value="Whois"></input>
</center>
</td></tr>

<tr><td>
<input type="radio" name="output" value="normal" checked></input> Regular output
<br></br>
<input type="radio" name="output" value="nice"></input> HTMLized output
<br></br>
<input type="radio" name="output" value="object"></input> Raw PHP object
</td>
[/PHP]

I am getting confused staring at "form action" and"form method" trying to figure this out, or if I am even in the proper place.

I am new to php/mysql etc...but not to programming... and again, thx for the replies...but I feel I am missing something easy here.

Jim

ps.. Markus, it shows an Unsubscribe option for me to click on here, but could you check the exact status for me?...As I should get an email reply?
Oct 25 '08 #5
acoder
16,027 Expert Mod 8TB
The first index.php is correct and that would work fine. The problem with your HTML file is that the form has no name, but if you give the input field an ID, then you can use document.getElementById(). In your index.php file containing example.html, find the body tag to add the onload. You can also use JavaScript to add the focus onload without messing with the HTML.

PS. re. notification problems: that's a bug. The subscription gets reset to no notification when you make a post, so you need to edit the subscription to change the notification options.
Oct 25 '08 #6
trochia
18
acoder, I again thank-you very much for the reply...and my late one.. ( e-mail notify, and I will go re-subscrime...I was figuring maybe because it got moved, it would reset)

So, I looked, and it said "subscribed"...so I huess you mean by EDIT to unSubscribe, then re-subscribe each time?

I screwed up, meaning the index.php example I gave above (or below) is NOT from the same project, I had just run a search on my drive...found an instance, or thought I could figure something out...(sigh)

As for
In your index.php file containing example.html, find the body tag to add the onload. You can also use JavaScript to add the focus onload without messing with the HTML.
In the code, there is "no body tag" in the index.php file, and I feel sorry about including it here, but I think what you are saying...or what I ?? Should Do ?? is add one somewhere?

Below is complete index.php file, that calls example.html

[PHP]
<?php
/*
Whois.php PHP classes to conduct whois queries
Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
Maintained by David Saez (david@ols.es)
For the most recent version of this package visit:
http://www.phpwhois.org
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

header('Content-Type: text/html; charset=UTF-8');

$out = implode("\n", file('example.html'));

$out = str_replace('{self}', $_SERVER['PHP_SELF'], $out);

$resout = extract_block($out, 'results');

if (isSet($_GET['query']))
{
$query = $_GET['query'];

if (!empty($_GET['output']))
$output = $_GET['output'];
else
$output = '';

include_once('whois.main.php');
include_once('whois.utils.php');

$whois = new Whois();

// Set to true if you want to allow proxy requests
$allowproxy = false;

// uncomment the following line to get faster but less acurate results
// $whois->deep_whois = false;

// To use special whois servers (see README)
//$whois->UseServer('uk','whois.nic.uk:1043?{hname} {ip} {query}');
//$whois->UseServer('au','whois-check.ausregistry.net.au');

// uncomment the following line to add support for non ICANN tld's
// $whois->non_icann = true;

$result = $whois->Lookup($query);

$resout = str_replace('{query}', $query, $resout);
$winfo = '';

switch ($output)
{
case 'object':
if ($whois->Query['status'] < 0)
{
$winfo = implode($whois->Query['errstr'],"\n<br></br>");
}
else
{
$utils = new utils;
$winfo = $utils->showObject($result);
}
break;

case 'nice':
if (!empty($result['rawdata']))
{
$utils = new utils;
$winfo = $utils->showHTML($result);
}
else
{
if (isset($whois->Query['errstr']))
$winfo = implode($whois->Query['errstr'],"\n<br></br>");
else
$winfo = 'Unexpected error';
}
break;

case 'proxy':
if ($allowproxy)
exit(serialize($result));

default:
if(!empty($result['rawdata']))
{
$winfo .= '<pre>'.implode($result['rawdata'],"\n").'</pre>';
}
else
{
$winfo = implode($whois->Query['errstr'],"\n<br></br>");
}
}

$winfo = utf8_encode($winfo);

$resout = str_replace('{result}', $winfo, $resout);
}
else
$resout = '';

echo str_replace('{results}', $resout, $out);

//-------------------------------------------------------------------------

function extract_block (&$plantilla,$mark,$retmark='')
{
$start = strpos($plantilla,'<!--'.$mark.'-->');
$final = strpos($plantilla,'<!--/'.$mark.'-->');

if ($start === false || $final === false) return;

$ini = $start+7+strlen($mark);

$ret=substr($plantilla,$ini,$final-$ini);

$final+=8+strlen($mark);

if ($retmark===false)
$plantilla=substr($plantilla,0,$start).substr($pla ntilla,$final);
else
{
if ($retmark=='') $retmark=$mark;
$plantilla=substr($plantilla,0,$start).'{'.$retmar k.'}'.substr($plantilla,$final);
}

return $ret;
}
?>
[/PHP]
Oct 25 '08 #7
trochia
18
Update, acoder...again, thx for everything... and thx for your help., for know...please don't spend the time looking at it, as I haven't tested it yet...but I think I have resolved it....

But I do need to get some sleep, lol...

Jim
Oct 26 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dan H. | last post by:
Hello, I want to try to retrieve the cursor position x and y relative to the form the cursor is over. The way I am doing it now is: 1. Retrieve the left and top position of the form relative...
1
by: Tantra Veda | last post by:
Hello C# gurus, I have a question about finding cursor position in NumericUpDown control. On my form I have a numericUpDown control with 2 decimal places. I want to increment value in the numeric...
1
by: objectref | last post by:
Hi to all, we have the MousePosition property that we can get the Point of the position of the mouse cursor on the screen, but is it there a way to get the respective Point of a cursor in a...
4
by: mike | last post by:
I have the opportunity to rescue a project that uses a mouse to sense the relative position of a machine. The hardware is built...just needs to be programmed. Stop snickering!!! I didn't do it...I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.