[Phpwm] possible?

Phil Beynon phil at infolinkelectronics.co.uk
Wed Mar 28 02:40:39 BST 2007

> > 'field' and 'image_id' refer to the id attributes of the input and the
> > image respectively (your page has 'text1'),
> That was me being sloppy! I chucked a page up which I hadnt read through
> properly - sorry about that!
> > and the function itself
> > attaches the onchange, so your HTML doesn't need to. You do need to
> > run it on window-load though:
> >
> > window.onload=function() {
> >   $('text1').onchange=function() {
> >     $('image_id').title=this.value;
> >   }
> > }
> Interesting, that works but it doesn't have the immediacy that I
> would have
> thought, the title tag value doesn't get updated until there is a click
> somewhere on the page despite the onchange being attached / used.
> > where $=document.getElementById because I'm lazy and always typo it.
> Ok! :-)

Hi Greg,

I've got this done a slightly different way now. The method you used tries
to 'push' the title data over using the onchange, but I found this had a
number of problems;
The title text didnt get updated until the form field had lost focus either
by clicking somewhere outside it or tabbing away from it.
There was no update after the spell checker was invoked and the only way to
get it to update was to add something like a space to the end of the text
then click / tab out.
Ditto using a reset / 'clear changes' button on the form.

So instead of pushing it across I've used a different method - to pull it
across using an onMouseover on the actual image itself;

<script language="JavaScript" type="text/JavaScript">
function pull_title_text(){
document.getElementById('pdficon').title =

<img src="manager/disc.gif" alt=" " width="16" height="16" border="0"
id="pdficon" title="" onMouseOver="pull_title_text();" >

<form name="formthree" method="post" action="">
<input name="descr" type="text" id="descr" value="wibble">

That seems to be working perfectly, without any of the above issues.

Thanks for your input!



More information about the Phpwm mailing list