JavaScript setFocus() - automatic 'focus on page load' - Smarty conflict?
|
robert070612
Joined: 2003-08-05
Posts: 565 |
Posted: Sat, 2005-10-15 23:17
|
|
Am trying to code automatic 'focus on load' for a text linker launch of the AdvancedSearch page. I understand this is normally done by JavaScript with which I'm not -that- familiar. My effort below does not do what is required but, at least, no longer causes an error. *insert the onLoad clause Quote:
[/templates/local/theme.tpl] *insert the name clause as it seems to be missing, hopefully this is the correct name Quote:
[modules/search/templates/block/local/SearchScan.tpl] * insert the new JavaScript stuff Quote:
[modules/search/templates/block/local/SearchScan.tpl] M$IE browser reports a JavaScript error in the status line. Can anyone oblige me with a code fix or other helpful suggestion please? ----best wishes, Robert [postedit: The drupal forum's search page code http://gallery.menalto.com/search isn't putting the cursor focus into its own new form box either. So even the forum isn't running the right code but that may be a different issue altogether I wouldn't know. Google's Advanced Search page does it every time http://www.google.co.uk/advanced_search and that's with the same kickstart of 'onLoad="setFocus()'. I've posted the code segments but there's something about G2 and/or Smarty that is stopping a standard JavaScript sequence running properly and the G2 advanced search form doesn't seem to have a 'name' either (bug report now filed). But what's the fix?] [postedit: after some 5days thread continued into http://gallery.menalto.com/node/38712 where an alternative programming technique provided the required functionality] |
|

Posts: 1
Hi!
I hope the following instruction may help you
Change <body class="gallery" onLoad="setFocus()"> into <body class="gallery">
And the insert the following code at the end of your html page
I you still need my help, please email to
Regards
Dahn Terry
Posts: 32509
1. you should attach yourself to the body, don't add onLoad in the body tag, see:
http://gallery.menalto.com/node/19392
2. forms in g2 have an id, you can use the id instead of the name.