I have an HTML page that has an imbedded script. I want to call if from a
link and pass two values as arguments. The HTML document is being loaded
into a script-aware applicatoin. When I click the link, I get an error :
"Wrong number of arguments or invalid property assignment 'ZoomToOcr'".

I'm sure this is simple...but I'm fairly new to the HTML side. BTW, a couple
of side issues: 1) I am only running the script from the link so I am
holding the HREF="". 2) The "Set SW" line relates to the environment in
which the script is running and the html page is being loaded. I've used
this before and it works fine.

Here's my header w/ script...followed by my <A> link section:

<HTML>
<HEAD><META HTTP-EQUIV=""Content-Type"" CONTENT=""text/html;
charset=windows-1252""><META NAME=""Generator"" CONTENT=""Microsoft Word
97""></HEAD>
<TITLE>OCR Search on DB Search Results</TITLE><p><p>

<SCRIPT LANGUAGE="VBScript"
TYPE="text/VBScript">
Sub ZoomToOCR(DocID, Line)
Set SW=window.external
SW.ZoomToOCRDoc DocID, Line, ""
End Sub
</SCRIPT>

<A HREF="" ONCLICK=ZoomToOCR "BK000001", 21>BK000001</A>


If anyone has any ideas, please let me know. Thanks in advance.

Paul

Re: Calling Sub w/ Arguments by Michael

Michael
Thu Oct 07 21:05:44 CDT 2004

> ... When I click the link,
> I get an error : "Wrong number of arguments or invalid property
> assignment 'ZoomToOcr'".

change this:

<A HREF="" ONCLICK=ZoomToOCR "BK000001", 21>BK000001</A>

to this:

<A HREF="" ONCLICK='ZoomToOCR "BK000001", 21'>BK000001</A>


or this:

<A HREF="" ONCLICK='Call ZoomToOCR("BK000001", 21)'>BK000001</A>


or this:

<A HREF="" ONCLICK='vbscript:ZoomToOCR "BK000001", 21'>BK000001</A>


to this:

<A HREF="" ONCLICK='vbscript:Call ZoomToOCR("BK000001",
21)'>BK000001</A>

the key being the enclosing single quotes (') around the script assigned as
the value of the onclick attribute.


--
Michael Harris
Microsoft.MVP.Scripting
Sammamish WA US


Re: Calling Sub w/ Arguments by Paul

Paul
Fri Oct 08 06:44:33 CDT 2004

Michael,

That was it. Thanks. Dead on. Hope you won't mind a follow-on that should be
pretty simple.

Now that this works, I realized the the HREF="" makes my page go away and it
is replaced by a directory listing of the directory in which the page
existed. What I am attepting is to have the HTML page stay at the same point
as it was when I clicked the link. This is long page w/ a list that is being
reviewed. The script calls a routine in the host application that opens the
source document in a new tabbed window...so when they click back on the tab
w/ my HTML page, it should still be where it was. I tried replacing the
HREF="" with HREF="pathtohtmlpage" and the intuitive result occured...when
you click back to the HTML page tab, the page is there, but it is refreshed
to the top.

I'd sure appreciate a quick tip. I know I could build anchors into my links
when the page is rendered...but I'm not sure of the best way to get back to
them...or if there is an easier way.

Thanks,
Paul

"Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message
news:%23czMTtNrEHA.1952@TK2MSFTNGP12.phx.gbl...
>> ... When I click the link,
>> I get an error : "Wrong number of arguments or invalid property
>> assignment 'ZoomToOcr'".
>
> change this:
>
> <A HREF="" ONCLICK=ZoomToOCR "BK000001", 21>BK000001</A>
>
> to this:
>
> <A HREF="" ONCLICK='ZoomToOCR "BK000001", 21'>BK000001</A>
>
>
> or this:
>
> <A HREF="" ONCLICK='Call ZoomToOCR("BK000001", 21)'>BK000001</A>
>
>
> or this:
>
> <A HREF="" ONCLICK='vbscript:ZoomToOCR "BK000001", 21'>BK000001</A>
>
>
> to this:
>
> <A HREF="" ONCLICK='vbscript:Call ZoomToOCR("BK000001",
> 21)'>BK000001</A>
>
> the key being the enclosing single quotes (') around the script assigned
> as
> the value of the onclick attribute.
>
>
> --
> Michael Harris
> Microsoft.MVP.Scripting
> Sammamish WA US
>



Re: Calling Sub w/ Arguments by Paul

Paul
Fri Oct 08 08:31:54 CDT 2004

Never mind. The anchors are too easy for words. It now says:
<A NAME="Hit35" HREF="#Hit35" ONCLICK=ZoomToOCR "BK000001", 21>BK000001</A>

Works like a charm. I guess you learn faster when you figure it out...huh.
:-)

Thanks again.
Paul

"Paul Engel" <pengel@source-imaging.com> wrote in message
news:eMljEvSrEHA.3288@TK2MSFTNGP12.phx.gbl...
> Michael,
>
> That was it. Thanks. Dead on. Hope you won't mind a follow-on that should
> be pretty simple.
>
> Now that this works, I realized the the HREF="" makes my page go away and
> it is replaced by a directory listing of the directory in which the page
> existed. What I am attepting is to have the HTML page stay at the same
> point as it was when I clicked the link. This is long page w/ a list that
> is being reviewed. The script calls a routine in the host application that
> opens the source document in a new tabbed window...so when they click back
> on the tab w/ my HTML page, it should still be where it was. I tried
> replacing the HREF="" with HREF="pathtohtmlpage" and the intuitive result
> occured...when you click back to the HTML page tab, the page is there, but
> it is refreshed to the top.
>
> I'd sure appreciate a quick tip. I know I could build anchors into my
> links when the page is rendered...but I'm not sure of the best way to get
> back to them...or if there is an easier way.
>
> Thanks,
> Paul
>
> "Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message
> news:%23czMTtNrEHA.1952@TK2MSFTNGP12.phx.gbl...
>>> ... When I click the link,
>>> I get an error : "Wrong number of arguments or invalid property
>>> assignment 'ZoomToOcr'".
>>
>> change this:
>>
>> <A HREF="" ONCLICK=ZoomToOCR "BK000001", 21>BK000001</A>
>>
>> to this:
>>
>> <A HREF="" ONCLICK='ZoomToOCR "BK000001", 21'>BK000001</A>
>>
>>
>> or this:
>>
>> <A HREF="" ONCLICK='Call ZoomToOCR("BK000001", 21)'>BK000001</A>
>>
>>
>> or this:
>>
>> <A HREF="" ONCLICK='vbscript:ZoomToOCR "BK000001", 21'>BK000001</A>
>>
>>
>> to this:
>>
>> <A HREF="" ONCLICK='vbscript:Call ZoomToOCR("BK000001",
>> 21)'>BK000001</A>
>>
>> the key being the enclosing single quotes (') around the script assigned
>> as
>> the value of the onclick attribute.
>>
>>
>> --
>> Michael Harris
>> Microsoft.MVP.Scripting
>> Sammamish WA US
>>
>
>



Re: Calling Sub w/ Arguments by Michael

Michael
Fri Oct 08 22:42:46 CDT 2004

Paul Engel wrote:
> Never mind. The anchors are too easy for words. It now says:
> <A NAME="Hit35" HREF="#Hit35" ONCLICK=ZoomToOCR "BK000001",
> 21>BK000001</A>
>
> Works like a charm. I guess you learn faster when you figure it
> out...huh. :-)

or in the ZoomToOCR sub, add

window.event.returnValue = false

which cancels the default action for the event (i.e., clicking an anchor
element would, by default, navigate the page to the url in the href, which
is not what you want to happen in this case).

--
Michael Harris
Microsoft.MVP.Scripting
Sammamish WA US