Forum Moderators: open
How do I execute both functions when the document loads?
Here are my two functions...
window.onload = externalLinks;
window.onload = findContent;
I tried...
window.onload = externalLinks; findContent;
...and that did not work.
Only problem now is I think one of my scripts broke!
I am having a problem with a focus script though now (or at least that part). It originally had it working and now it's not?
Anyway here is the code for that script alone...
HTML
<form action="" class="search" id="search" method="post">
<fieldset>
<input type="hidden" name="path" value="" />
<input type="hidden" name="refine" value="0" />
<input type="hidden" name="result_page" value="" />
<label class="search" for="query_string">Search Site</label>
<input id="query_string" maxlength="50" name="query_string" size="9" onfocus="javascript:if(this.value=='Search...') {this.value='';}" onblur="javascript:if(this.value=='') {this.value='Search...'}" tabindex="1" type="text" value="Search..." />
<input class="button" type="submit" value="Search" />
</fieldset>
</form>
CSS
<!--
//
// Search Focus
//function addEvent(obj, evType, fn){
if (obj.addEventListener){
obj.addEventListener(evType, fn, true);
return true;
} else if (obj.attachEvent){
var r = obj.attachEvent("on"+evType, fn);
return r;
} else {
return false;
}
}function findSearch()
{
if (! document.getElementById("search"))
{ return false;}
else
{ addEvent(window, 'load', function() { document.getElementById('query_string').focus()});}
}
window.onload = findSearch();//-->
I'm not getting any errors...it should be finding the ID of Search which is on the form element.