Forum Moderators: open
I wrote a function to fill in the text fields of an online form from an Excel sheet:
javascript:function%20autofill()
{var r=1,j ; var F= document.contactadd; var XA = new ActiveXObject("Excel.Application");
if (XA!= null) {XA.Visible = true; XA.Workbooks.Open("C:/files/leads2.xls");
var XB = XA.Workbooks(1).Worksheets(1);
if(r=window.prompt('row #: ','') = null) r=1;
E= document.forms [0].elements;
// doc form [0] elements.length =24
E [1].selectedIndex = 0;
E [2]. checked=true ;
E [3].selectedIndex = 0;
E [4].selectedIndex = 0;
E [5].selectedIndex = 0;
for(j=4;j< E.length;j++) // skip non text fields
{if(j==5¦¦j==7¦¦j==10¦¦j==16 ¦¦ j==17¦¦ j==19¦¦ j==22) continue;
if (XB.Cells(r,j).Value!=null) document.forms [0].elements [j].value = XB.Cells(r,j).Value;
}}}autofill();void(null)
The problem is and it is a complete bonehead manueuver on my part, I have forgotten how to execute this function from the URL address box of my browzer. argh!
Please assist. Thanx
To answer your question, to get a JavaScript function to execute directly from the address bar in a browser, type:
javascript:functionname()
I don't know why you wouldn't just make a link or button you could just click, though:
<A href="#" onclick="functionname()">
Hope this helps.