Need help running this Javascript code on Internet Explorer 7 - javascript

I am running the following JavaScript Bookmarklet code in Chrome and it's running perfectly fine. However, only a blank window opens when I try the same code in IE.
javascript:var str=document.documentElement.innerHTML;
var find='</textarea>';var re=RegExp(find,'g');str=str.replace(re,"</OMG>");
var cmrform = document.createElement("form");cmrform.target="CMRWindow";cmrform.method="POST";
cmrform.action="http://localhost:8080/cmr/CMRTool.jsp";
var srcInput=document.createElement("input");srcInput.type="text";srcInput.name="sourceCode";srcInput.value=str;cmrform.appendChild(srcInput);CMRWindow=window.open("","CMRWindow","status=0,title=0,height=600,width=800,scrollbars=1");cmrform.submit();
Can someone please guide me why this code is not working in IE.
Thanks In Advance :)

Use document.forms instead of cmrform:
document.forms[document.forms.length - 1].submit();

Related

How to enter keystrokes like ENTER,TAB, etc. in firefox browser using protractor framework?

I am trying to enter keystrokes(TAB) in my script.
I have used the following code:
browser.actions().sendKeys(protractor.Key.TAB).perform();
This is working in chrome but not working in firefox browser.
browser.actions().sendKeys(protractor.Key.TAB).sendKeys(protractor.Key.ENTER);
browser.actions().sendKeys(protractor.Key.TAB).sendKeys(protractor.Key.RETURN);
These 2 approaches are not even working in chrome also.
I need to run my script in firefox with entering keystrokes. Please help me...
Try to init some element on the page and send the key chord to it.
element(by.id('<visible element on the page>')).sendKeys(Key.chord(protractor.Key.TAB, protractor.Key.ENTER));
or try with browser actions:
browser.actions().sendKeys(Key.chord(protractor.Key.TAB, protractor.Key.ENTER));

window.close() not working in chrome version 36.0.1985.143

The code i used in the javascript to close the window is as follows
window.open('','_self','');
window.close();
in jsp
Close
it's not working in chrome version 36.0.1985.143, it worked in previous chrome version, IE and in FF also. How can i fix it.
Please help me.
Thanks in advance.
The chrome latest release has changed that functionlity as there has been several security issues because of that. You need to try like this:
chrome.windows.remove(integer windowId, function callback)
You can check here

Click events and Google Chrome and Windows 8

I am trying to use the following JQuery code:
$("#thing").on("click", function() {
....})
And it doesn't work on Google Chrome in Windows 8, but it works in Firefox on Windows 8 and basically every other OS. Any ideas?
It works, check this: http://jsbin.com/ofuvuh/1 Probably there is some error in the code that ff ignore or maybe it's your browsers fault. Please check the chrome and ie console, probably it can helps
Try:
$("#thing").click(function ()
{
// your code here
});
Which is the same as .on('click', handler). See .click documentation.
Your code snippet looks completely fine. I assume you are using a fairly up to date version of jQuery, so most probably it is nothing to do with jQuery or the browser. I suspect there might be something wrong with the code surrounding your snippet.
As a possible solution:
In Chrome you can bring up the Console, which will tell you if there is any errors in your JavaScript (developers.google.com/chrome-developer-tools/docs/…). Open it up, refresh your page (you might see the error in the Console straight away). Or click that '#thing' and watch out for any possible errors coming up in the Console.

jQuery Gallery won't work in any version of Internet Explorer

I wrote my original jQuery code and saw that it wasn't working in any version of IE.
I used JSLint to figure out why it wasn't working in any version of internet explorer.
Here is my new code that I cleaned up using JSLint http://theburnmachinept.com/js/scripts.js.
This still refuses to work on any version of IE. AND to top it off it doesn't work on any browser now. I switched back to the ORIGINALscripts.js file for the time being. Can anyone find anything wrong with my code? The code in question is the gallery code that starts on line 17 and ends on line 126.
I would greatly appreciate any help anyone could offer.
I think, $('#image').hide(); causes it, try $('#image').fadeOut();

jQuery plugin Cross Slide and Internet Explorer

I am using the jQuery plugin Cross Slide. My page is working fine in Chrome and Firefox. But in Internet Explorer 7, I get:
Debug error as Object expected on line 1:
$(document).ready(function() {
$('#image').crossSlide({sleep:4,fade:1},[{src:'images/1.jpg'},{src:'images/2.jpg'}]);
});
How can I fix the bug for Internet Explorer 8 and Internet Explorer 7?
I had the same problem, you just have to delete the comma after the last picture you point to. This should work in IE.
Greets
Try with companion.js. It points you to the JavaScript line that has the problem instead of the default line 1. Moreover, try with unpacked JavaScript code so that you know what is wrong.
Could you provide more code or even better, a working page that reproduces the problem? That little piece of code looks fine so far...
By the way, the "on line 1" tells you absolutely nothing in IE, don't trust it.

Categories