Website I'm on has a bunch of chat rooms that can be accessed via a dropdown menu. Problem is the Dropdown menu is generated via VBScript while the buttons themselves are Javascript. I have no p开发者_JAVA技巧roblem using Internet Explorer, but a friend of mine really needs to use these rooms and cannot as she is on a mac. I'm trying to create a Greasemonkey script that will create these buttons elsewhere on the page so she can actually click on them, but I have no experience with Greasemonkey or Javascript at all.
When I right click a button in IE and choose Properties this is the code it gives me. I hope this is what you'd need to help, if not please let me know and I'll try to get what you need.
javascript:OpenWindow('/Portal/ChatTransfer.aspx?
chatroom=ATTNesting1&url=https://chat02.arise.com/chat/
','','width=800px,height=600px,status=no,menubar=yes,
scrollbars=yes,titlebar=no,resizable=yes,toolbar=no,location=no');
In short...
// create button
var btn = document.createElement( 'input' );
with( btn ) {
setAttribute( 'onclick', 'alert( "you clicked me!" )' );
setAttribute( 'value', 'click me!' );
setAttribute( 'type', 'button' );
}
// append at end
document.getElementsByTagName( 'body' )[ 0 ].appendChild( btn );
This should add a button at the end of the page; of course you have to replace the alert()
in the onclick-attribute with your desired OpenWindow()
-function call. And I guess you have to address it with unsafeWindow.OpenWindow()
.
Another much-easier option is to make bookmarklets; bookmarks that execute javascript. Simply create a bookmark with each of the javascript:
URLs and add void(0);
to the end. Then you can click the bookmarks to do the actions.
精彩评论