Doubling Backslashes In JavaScript - It's Unorthodox, But It Works...

May 17, 2007

I've spent the last two hours trying every other solution listed, to
no avail: this works, so I'm sharing it for the other folks who
couldn't find a solution other than switching to another language.

var fileString = "mydevfolderfolder2folder3file.txt";

var myPat = /%5C/g; //this is using regular expression to
define the escaped version of a backslash

fileString = escape(fileString);
fileString = fileString.replace(myPat,"%5C%5C");
fileString = unescape(fileString);

fileString now equals "\mydevfolderfolder2folder3 file.txt"

View 9 Replies


ADVERTISEMENT

JavaScript Popup On Window Close: Works Great On IE, Works Terribly On FF

Dec 13, 2006

I'm just restating my "site abandonment" post but with a clearer title as I realized it probably only made sense to me and me alone.

I have window that pops up with our commerce system. I have it set to pop up a window via JavaScript if the visitor quits early in the process (abandons the commerce system before completing all of the steps. The new popup is just a customer survey ("why are you leaving, is there something else we can help you with" etc. etc.).

Here's the problem, it works fine in IE, but in Firefox, anytime the page in the original commerce window is changed, refreshed or advanced to a new page, the survey popup window is called rather than just on window close.

Again, here's the two JavaScript routines that handle clicks on the graphical close button and on the window 'X' close button. Code:

View 9 Replies View Related

Place Backslashes Into A Newly Created File

Feb 6, 2011

I know that this is partially a PHP code, however; the portion that I need help with is Javascript so I decided to put it in the javascript category. This code takes the text contained in $code5 and puts it in a .js file. The problem is that when the text in $code5 is placed in the .js file, the backslashes () before the quotes (") are deleted. I need these backslashes to remain when the code is placed in the . js file. I tried adding a second backslash next to each backslah to see if that would work, but it didn't.

[Code]...

View 7 Replies View Related

JQuery :: Script Doubling Div - Tab Navigation System?

Apr 30, 2009

In a website that I am developing, I have a tab navigation system and I tried to dynamic load the #content of each page in the #content div of the main page withe the next script and next html:

But when I run the script it doubling the #content div.

View 1 Replies View Related

JQuery :: Doubling Up Selectors - Highlight In Grey A Row In A List

Apr 6, 2009

I have some jquery code that will highlight in grey a row in a list when it's hovered over - ie:

[Code]...

but of course that will highlight every -even and -odd row, but I want to exclude the list classed .views-important-dates. I can get bloated with it and duplicate the whole code, or I could write a function (which is a definite possibility) but I was wondering if there was a conditional way I could do this - for eg:

[Code]...

View 1 Replies View Related

Javascript Works In FF But Not In IE

Nov 27, 2005

I have the following javascript function, which works fine in Firefox but does not work in IE. I have a feeling it has something to do with window.status. Any ideas??

<!-- START JAVASCRIPT -->
<script type=text/javascript>
function tracker() {
window.focus();
if (window.status) {
click = new Image();
click.src = 'http://myurl.com/tracker.php?pid=12345&type=click'
}
};
view = new Image();
view.src = 'http://myurl.com/tracker.php?pid=12345&type=view'
//-->
</script>

<!-- END JAVASCRIPT -->

<!-- START BANNER CODE -->
<a href="http://www.myurl.com/purchase.php?pid=12345" onMouseDown="tracker();"

onMouseOver="status='http://www.myurl.com/purchase.php'return true;" onMouseOut="status=''"><img

src='http://www.myurl.com/images/banners/banner.gif' alt='product' border=&#390;'></a>
<!-- END BANNER CODE -->

View 7 Replies View Related

Xhtml W/javascript And Css Only Works In IE

Jul 23, 2005

There are two main things which I am trying to work through:

Drop down menu (bottom of page) - which only works in IE (on pc) right
now, although it should work on all browsers except opera.
Traditionally in a HTML 4.0 Transitional environment.

Div content that scrolls - placed correctly and works in IE and that's
it. Here is an example of the working script on another site
http://www.dyn-web.com/dhtml/scroll/scroll-rel.html . Traditionally in
a Xhml strict.

My goal is to get this page to look as good in Netscape and on the mac
as it already does in IE.

View 2 Replies View Related

Javascript, Replace Works Only With FF

Jun 29, 2006

I want to remove from string a <span> tag, but with leave the value of
that tag.

I have that code:

theExp = new RegExp("<span>", "g");
txt = txt.replace(theExp, "");

theExp1 = new RegExp("</span>", "g");
txt = txt.replace(theExp1, "");

and this works only with FF,
With IE it doesn't remove the tag.
With Opera the same

View 4 Replies View Related

Javascript Works In Firefox, But Not In IE

Aug 11, 2006

Usually it's the other way (IE works, Firefox not working)... but here it is. IE does render something, although it puts the advert script (starting on line 9) at the very end, after the close of the last table. Firefox displays it as I have intended it (Ad inside the table). Code:

View 1 Replies View Related

Why This Javascript Function Does Not Work On IE5, But Works On IE6?

Jul 20, 2005

function CheckImageBtn(eleName,sortfield)
{
document.forms[0].sortby.value=sortfield;
document.forms[0].txtIsHrefClick.value = 'Y'

var objElem;
objElem=eval("document.all."+eleName);
objElem.focus();
objElem.click();
return true;
}

View 1 Replies View Related

Some DOM Javascript Code Works Only In Firefox 2.0, Not 1.5, Why?

Mar 1, 2007

I have some code, using all the DOM documentation in the developer.mozilla.org website. For some reason it's only working in the newest Firefox 2 versions, and not 1.5.0.x

I'm having a hard time finding any documentation of what's not supported.

Can you guys help me? Here are the functions I'm calling:

getRangeAt();

range.collapsed

document.createElement("div");

range.cloneContents();

element.appendChild(clone);

document.getElementById("divid");

do you think it's createElement div? Maybe I can't create a div element?

View 1 Replies View Related

Javascript Frames Works Netscape Not Internet Explorer

Jul 23, 2005

I have a page with two frames, 'header' and 'main'. The following
code works in Netscape, but in Internet Explorer. The second bgColor
line produces an error:

function test(){
top.frames.header.document.bgColor='white' //works fine
top.frames.main.document.bgColor='white' //fails
}

View 1 Replies View Related

Dynamically Writing Html/javascript From A Javascript Function

Jul 23, 2005

I'm working on some code and am running into brick walls. I'm trying
to write out Javascript with Javascript and I've read the clj Meta FAQ
and didn't see the answer, read many similar posts (with no luck
though), and searched through the IRT.ORG Faqs
(www.irt.org/script/script.htm).

The Javascript is designed to open an popup window and then inside that
window call another script which will resize that window. There may be
another way around this but the reason I tried this approach initially
was that I wanted to call the onload handler in the popup window to
resize the image only after the image had completely loaded. I've had
some code in the primary Javascript file (showimage.js) before that
works if the image has been cached but on the first load, it doesn't
resize properly which tells me it is probably because it is trying to
resize the window based on the image size but it isn't completely known
at that point. So I removed that code and tried placing the resizing
code in the second Javascript file (resizewindow.js). BTW I've tried
other code to open a popup image and automatically size it ie Q1443 at
irt.org but that doesn't do exactly what we need.

Even if there is another way to do this with one file, I still want to
figure out why this isn't working in case I run into it in the future.

I thought what I would need to do to use document.writeln to write
Javascript would be to escape any special characters and to break
apart the script tag ie

document.writeln('</SCRIPT>');

would become

document.writeln('</SCR' + 'IPT>');

I have a HTML page and 2 Javascript files. All files are in the same
directory and have permissions set correctly.

Here are the 3 files (keep in mind wordwrap has jacked up the
formatting):

index.html
----------
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<SCRIPT type="text/javascript" LANGUAGE="JavaScript1.1"
SRC="showimage.js">
</SCRIPT>
</head>

<body>
Click the house<BR>
<A ONCLICK="newWindow1('house1.jpg','Nice House')"><IMG
SRC="house1thumb.jpg"></A>
</body>
</html>


showimage.js
------------
function newWindow1(pic,sitename)
{

picWindow=window.open('','','width=25,height=25,sc rollbars=1,resizable=1');
picWindow.document.writeln('<html> <head>');
picWindow.document.writeln('<SCR' + 'IPT type="text/javascript"
LANGUAGE="JavaScript1.1" SRC="resizewindow.js"></SCR' + 'IPT>');
picWindow.document.writeln('</head>');
picWindow.document.writeln('<body onload="resizewindow();">');
picWindow.document.writeln('<img src=' + pic + '>');
picWindow.document.writeln('</body> </html>');
picWindow.document.close();
}

resizewindow.js
---------------
function resizewindow()
{
// Do resizing here.
// Right now this isn't being executed
alert("resizing window");
}


Can anyone provide some pointers as to why this javascript is failing?
I'm using IE6 on Win2k and when I click on the image to open the popup
window, it does open the window but it is white with no content and the
system immediately goes from about 4% CPU usage to 100% and
consistently stays there until I kill that window with the task
manager.

View 9 Replies View Related

DOM Javascript - Imbed Javascript In Dynamically Added Row

Jul 23, 2005

Attached is a simple HTML file that adds and delete rows. In the add
row function I set an attribute "onClick" this triggers the
testMessage() function. When I try this in Firefox it works just fine
however on IE it just refuses to work.

What is interseting is the ROW that already exists has a similar
'onClick' event which works when the page is loaded, but subsequent
"row" additions to the table to not work in IE. Code:

View 9 Replies View Related

Text/javascript, Application/x-javascript, Difference?

Feb 19, 2007

two possibilities or the attribute type of script:

text/javascript (the one i usually use) application/x-javascript

what are the differencies between both?

depends on the html content?

for example html 4.0.1 versus xhtml 1.1?

View 12 Replies View Related

Javascript Function Has No Properties In Javascript Console

May 25, 2005

I'm getting errors in Firefox everytime I try to run this frame resize code, but it works fine in IE. I can't seem to figure out what the problem is with it.

The error is: Error: theFrame has no properties
Line: 8

The line that the javascript console is showing an error for is in italics.

code from page:

<html>
<head>
<script type="text/javascript">
var defaultCols="100px,*";
var hiddenCols="0px,*";
function ShowHideMenu(){
theFrame = document.getElementById("framed");
if(theFrame.cols == defaultCols) theFrame.cols=hiddenCols;
else theFrame.cols=defaultCols;
}
</script>
<frameset cols="100px,*" name="framed">
<frame src="lframe.htm" name="frameMenu">
<frame src="mframe.htm" name="content">
</frameset>
</head>
<body>
</body></html>

Come someone let me know what I'm doing wrong here?

View 2 Replies View Related

'Javascript Anthology' Or 'Professional Javascript For Web Developers'?

Mar 30, 2006

I'm already past the basics of Javascript, and i need something that takes me to the other level and teaches me the new technologies and cool stuff (drag&drop, AJAX, OOP in javascript, maybe XUL...etc). So far i found these two books:

1. Sitepoint's "The JavaScript Anthology: 101 Essential Tips, Tricks & Hacks".
2. Worx's "Professional JavaScript for Web Developers (Wrox Professional Guides)"

Both seems to cover very insteresting topics, but i can only buy one of them. So which one do you suggest?

and by the way, i've read the sample chapter 5 of Sitepoint's book, and it seems like the author(s) just put the solutions/codes there and let you figure them out on your own. Is this how the rest of the chapters are?

View 3 Replies View Related

Getting JS That Works In FF?

Mar 24, 2011

So I have this code listed below:

<script type="text/javascript">
if (!window.console) {
window.console = {

[code]...

It works perfectly fine in IE but as soon as I load it in FF it does nothing.

View 1 Replies View Related

IE Works Once (more Or Less) But Not Again

Nov 26, 2010

I have a page at the following url:[URL]Pick a continent, select a country ( orange if in Asia, green if in Africa) click on one of the bullets and some info pops up. Works fine in FF and Safari but in IE, it works (almost) once, but then goes dead i.e. the links seem to disappear. get this working in all browsers?

View 3 Replies View Related

Works In IE7 But Not In IE8

Jan 5, 2011

check out this page [URL] (you might see an ERROR like "Notice: Undefined index: SCRIPT_URI ... on line 23" THAT'S FINE - that page sets a cookie to allow you to see the header with login on homepage)

then go to the homepage: [URL] and try to click on "Log In" in top right corner a overlay with iFrame opens IE7 but not in IE8

what's the right way to handle something like this? approach? steps? techniques? tools?

View 1 Replies View Related

Nav Works In IE6 Not In IE7?

Mar 24, 2010

I built a horizontal navigation dropdown menu and it works in IE6, but when we were pushed IE7 it stoped working. Is it my javascript or is it my CSS (do I need html hacks for IE7 )

HTML Code:
[b]javascript:[/b]
// JavaScript Document[code]......

View 6 Replies View Related

Js Works In FF Not IE?

Nov 22, 2010

I should probably know the tricks about javascript not working in IE etc. I'm sure this is something very basic. I just can't figure it out, and it's really not my strong suit.I'm testing it with IE8.IE is getting stuck on two of these ajax functions:

--------- the error -----------
Message: Unknown runtime error
Line: 47
Char: 5
Code: 0
------------------------------

Code:

function blcode_search(blcode,asa_hash) {
if (window.XMLHttpRequest)

[code]...

Edit: I tried messing with the security settings and everything... IE is running in please exploit me mode.

View 1 Replies View Related

This Works In IE But Not In Mozilla

Jul 23, 2005

I have some functions in a script in which I'm manipulating the
innerText and background colors of certain rows in a table. The lines
below work OK in IE but when I try them in Mozilla, I get an error
that says: "document.getElementById('TableX').rows is not a
function".

thisRow = document.getElementById('TableX').rows(1);
thisRow.style.background = 'white'

Can anyone give me a clue as to how to fix this so that it will work
in both browsers?

View 2 Replies View Related

Script Works In IE Not FF

Jul 21, 2006

I have a script that works perfectly in IE but not in FF. I am sure that the problem is easy to resolve, but I seem to be too dumb to figure it out......

View 9 Replies View Related

JQuery :: Css Works In IE Not FF

May 30, 2010

The following works in IE8 but not firefox. q is a variable that is an id:an example of the selector is [code]

View 1 Replies View Related

Script Only Works On First Row?

Mar 30, 2011

i have a dynamic update form with 2 checkboxesi use the following to check/uncheck the checkboxes so that only 1 is ever checked, the checkbx also updates the record using onclick.The onclick for updating record works fine for every returned record however the javascript will on function on the first record

Code:
<script type="text/javascript">
function checkplay()

[code]....

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved