Click to See Complete Forum and Search --> : How to pass parameters to an include


awegrzyn
08-25-2003, 09:21 AM
Hi.

I have a script as an include and it's included on the page.
<script language=javascript src="Focus.js"></script>

I would like to pass control name to that included script so that I could reuse the script on other forms.

The script looks like this.

var control = document.getElementById("UserName");

if( control != null )
{
control.focus();
}

Thanks,
Andy

AdamBrill
08-25-2003, 09:33 AM
You should make a function. It would look like this:

function functionname(control){
if(control != null){
control.focus();
}
}

Then you would call the function like this:

functionname(document.getElementById("UserName"));

I hope that helps! :)