473,406 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Window.open. Works in ie6. Does not work in firefox

dlf

Hello,

I'm building a little web with php and javascript. I have inside HEAD
the following function:

This function receives as parameters a url and a string. In the url it
changes "aaaa" chars, inserting the value received in the string.

<script type="text/javascript">
function abrir(url,cadena){
nuevaurl=url.replace("aaaa",cadena);
window.open(nuevaurl);
}
</script>

I call it with these lines:
<INPUT onclick='abrir("<? echo$row_lista['url'];?>",unico.value)'
type=button value=OK name=button_nameprod>

My problem is that it works perfectly with ie6, but not with firefox.
I push the button and it happens nothing.

Any suggestion? Is it something related to my use of window.open?
Thanks a lot!

Jun 27 '08 #1
5 1350
dlf wrote:
Hello,

I'm building a little web with php and javascript. I have inside HEAD
the following function:

This function receives as parameters a url and a string. In the url it
changes "aaaa" chars, inserting the value received in the string.

<script type="text/javascript">
function abrir(url,cadena){
nuevaurl=url.replace("aaaa",cadena);
window.open(nuevaurl);
}
</script>
Works fine here.
>
I call it with these lines:
<INPUT onclick='abrir("<? echo$row_lista['url'];?>",unico.value)'
type=button value=OK name=button_nameprod>
Is 'unico.value' set?
>
My problem is that it works perfectly with ie6, but not with firefox.
I push the button and it happens nothing.
What version are you using? Install 'firebug': it's a perfect tool for
debugging things like this:

http://www.getfirebug.com/

Bart
Jun 27 '08 #2
dlf wrote on 09 jun 2008 in comp.lang.javascript:
>
Hello,

I'm building a little web with php and javascript. I have inside HEAD
the following function:

This function receives as parameters a url and a string. In the url it
changes "aaaa" chars, inserting the value received in the string.

<script type="text/javascript">
function abrir(url,cadena){
nuevaurl=url.replace("aaaa",cadena);
replace() needs a regular expression, not a string.

You should mention the error text and the error line number,
and do some debugging.
window.open(nuevaurl);
}
</script>

I call it with these lines:
<INPUT onclick='abrir("<? echo$row_lista['url'];?>",unico.value)'
type=button value=OK name=button_nameprod>

My problem is that it works perfectly with ie6, but not with firefox.
I push the button and it happens nothing.

Any suggestion? Is it something related to my use of window.open?
Thanks a lot!


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 27 '08 #3
Try:
function abrir(url,cadena){
nuevaurl=url.replace("aaaa",cadena);
var nuevaurl = url.replace(/aaaa/, cadena);
window.open(nuevaurl);
The "var" keyword makes the variable local to the funcion.
Also, replace()'s first argument must be a regular expression.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
Jun 27 '08 #4
dlf
On 9 jun, 17:46, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
dlf wrote on 09 jun 2008 in comp.lang.javascript:
Hello,
I'm building a little web with php and javascript. I have inside HEAD
the following function:
This function receives as parameters a url and a string. In the url it
changes "aaaa" chars, inserting the value received in the string.
<script type="text/javascript">
function abrir(url,cadena){
nuevaurl=url.replace("aaaa",cadena);

replace() needs a regular expression, not a string.

You should mention the error text and the error line number,
and do some debugging.
window.open(nuevaurl);
}
</script>
I call it with these lines:
<INPUT onclick='abrir("<? echo$row_lista['url'];?>",unico.value)'
type=button value=OK name=button_nameprod>
My problem is that it works perfectly with ie6, but not with firefox.
I push the button and it happens nothing.
Any suggestion? Is it something related to my use of window.open?
Thanks a lot!

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Hi,

Thanks a lot for your responses. I will check firebug.

unico.value is set, yes.

In fact i don't receive any error. The window simply does not appear :-
(

Regards,
David
Jun 27 '08 #5
dlf wrote on 09 jun 2008 in comp.lang.javascript:
<script type="text/javascript">
function abrir(url,cadena){
nuevaurl=url.replace("aaaa",cadena);

replace() needs a regular expression, not a string.

You should mention the error text and the error line number,
and do some debugging.
window.open(nuevaurl);
}
</script>
[please do not quote signatures on usenet]
Thanks a lot for your responses. I will check firebug.

unico.value is set, yes.

In fact i don't receive any error. The window simply does not appear :-
If there is no error, You should set a breakpoint:

nuevaurl=url.replace("aaaa",cadena);
alert(nuevaurl) // breakpoint
window.open(nuevaurl);

Then you probably would see the open() statement is not the culprit.

That is what debugging is about.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: fogwolf | last post by:
First a basic outline of what I am trying to do: I want to have a page spawn a pop-up when you click "submit" on its form. On this pop-up page there will be another form. When you click "submit"...
5
by: Derek Erb | last post by:
I am banging my head against the wall with this one. The following code snippets work perfectly fine in MSIE6. But produce an error in Firefox and do not work at all. BROWSER.HTM <HTML> .......
8
by: Dominic Tocci | last post by:
I'm searching for a way to use window.open on my web page to open a window in firefox that allows the sidebars to work (bookmarks, history, etc). When I use the following: var...
7
by: MrFez | last post by:
Through some investigation it appears that selecting "Every visit to the page" for the IE caching setting "Check for new version of stored pages" causes the window.opener property of child windows...
13
by: tochiromifune | last post by:
Hello The window.open method brings my window to the top only if it is new. If it's being reused, the window does not come to the foreground (with IE 6 it does). Is there a new way in...
18
by: len.hartley | last post by:
Hi, I am trying to pop-up a window when the user clicks on an image. The problem is that when the user clicks on the image and the window pops up OK, but the window underneath also proceeds to...
21
by: alistair_henderson | last post by:
Morning All, I have some code for a website which uses 'window.open' to simulate modal dialog boxes. I use the window.closed property to decide if the window object exists at various points. ...
4
by: Andre | last post by:
With Firefox 1.5+, I used the following code to close a window/tab: === <html><head> <script language="javascript" type="text/javascript"> function closeWindow() { window.open('','_parent','');...
6
by: Howard Rifkin | last post by:
Hi, I my Javascript I popup an authentication window using the command; unamePasswdWindow = open("auth.html","","width=500,height=100"); This works fine in IE, and in Firefox 2.x on...
16
by: CreativeMind | last post by:
hi, i have a page calendar.aspx which returns selected date i.e window.returnValue=selectedDate; window.close(); it works fine with IE but not for Firefox. i tried...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.