problem launching window.open(javascript:setCursorPosition(1527,'HATSFORM'))

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • billster

    #1

    problem launching window.open(javascript:setCursorPosition(1527,'HATSFORM'))

    Hi,

    I am trying to launch a new browser with the same url location as the
    current browser, and at the same time run some javascript.

    This works with <a href=javascript :setCursorPosit ion(1527,'HATSF ORM')>test</a>
    , which runs the javascript in the current url location, but when I
    try window.open(jav ascript:setCurs orPosition(1527 ,'HATSFORM'), it
    opens a new browser with the string
    "javascript:set CursorPosition( 1527,'HATSFORM' )" in the url location of
    the browser, which obviously fails.

    So I need the window.open to open up a new browser with the same
    relative url and then execute the javascript string. Any ideas?

    BTW, this also fails when I try <a
    href=javascript :setCursorPosit ion(1527,'HATSF ORM')
    target=_NEW>tes t</a> for the same reason that the relative url
    location is not kept for the new browser.

    Thanks in advance
    Bill
  • Mike

    #2
    Re: problem launching window.open(jav ascript:setCurs orPosition(1527 ,'HATSFORM'))

    > This works with <a
    href=javascript :setCursorPosit ion(1527,'HATSF ORM')>test</a>

    I'm guessing that this method simply moves the current window to the correct
    location on the page.
    [color=blue]
    > , which runs the javascript in the current url location, but when I
    > try window.open(jav ascript:setCurs orPosition(1527 ,'HATSFORM'), it
    > opens a new browser with the string
    > "javascript:set CursorPosition( 1527,'HATSFORM' )" in the url location of
    > the browser, which obviously fails.[/color]

    Yeah, window.open requires a URL to be passed. I think what you need to
    something like this:

    var newwindow = window.open(win dow.location.hr ef);
    newwindow.setCu rsorPosition(15 27,'HATSFORM');


    The idea is to open a new window with the same URL as the current window and
    then call the setCursorPositi on() method with the correct parameters in the
    new window. This is assuming that the method will exist in the new window.

    Hope this helps
    Mike


    Comment

    Working...