doa24uk Posted October 9, 2009 Share Posted October 9, 2009 Hi guys, This works perfectly .... var mySplit = "123456789"; var mySplitResult = url.split("5"); window.open('http://none.com/mypage.php?id=' + mySplitResult[0], 'window name') So why doesn't this ?? (presume the selected text is "123456789" - same as the above example) --> var focusedWindow = document.commandDispatcher.focusedWindow; if (focusedWindow == window) focusedWindow = getBrowser().contentWindow; var url = focusedWindow.getSelection(); var mySplitResult = url.split("5"); window.open('http://mirrorchecker.com/linkchecker2.php?url=' + mySplitResult[0], 'window name') Link to comment https://forums.phpfreaks.com/topic/177129-solved-confusing-split-problem/ Share on other sites More sharing options...
salathe Posted October 9, 2009 Share Posted October 9, 2009 In your second code block, the value of url will not be a string (it'll be an object for the selection). A quick fix (I guess, not tested) would be: var url = focusedWindow.getSelection().toString(); Link to comment https://forums.phpfreaks.com/topic/177129-solved-confusing-split-problem/#findComment-933951 Share on other sites More sharing options...
doa24uk Posted October 9, 2009 Author Share Posted October 9, 2009 I thought it would be something like that (not being in a useful form) but don't know JS that well. Good news is that your code did the trick! Many thanks Link to comment https://forums.phpfreaks.com/topic/177129-solved-confusing-split-problem/#findComment-933969 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.