Hi!

I have this javascript function in my test.html file which is loaded in the WebView:

function goToPage(mybox) {
  window.location ='#' + mybox.value;
}

It allows me to enter a number, like 24, which then goes to the anchor tag <a name="24">. It serves the purpose of navigating a long html file. It works perfectly if I type in the value in a textfield nested inside test.html, like this <input type="text" style="font-size: 8px" size=3 maxlength="2" onchange="goToPage(this)"/>.

I would rather do this with an NSTextField. I tried connecting the first method and then other to the NSTextField, but it doesn't work:

- (IBAction)runJavaScript:(id)sender {
        [theWebView stringByEvaluatingJavaScriptFromString:@"goToPage"];
}

and this:

- (IBAction)runJavaScript:(id)sender {
[[theWebView windowScriptObject] callWebScriptMethod:@"goToPage" withArguments:nil];
}

But neither methods work. Any ideas?

--Philip
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to