homepage Welcome to WebmasterWorld Guest from 54.237.99.131
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Browsers / Firefox Browser Usage and Support
Forum Library, Charter, Moderators: incrediBILL

Firefox Browser Usage and Support Forum

    
Onchange event not working on Firefox?
Nazgoth

5+ Year Member



 
Msg#: 285 posted 12:09 pm on Jan 17, 2005 (gmt 0)

I'm having some problems on Firefox when using the onchange event.
Basically the onchange calls 2 javascript functions and it works fine on IE but not on FF.
The website address is <SNIP>
Any help or suggestions would be appreciated.

[edited by: BlobFisk at 12:48 pm (utc) on Jan. 17, 2005]
[edit reason] No URLs please! See TOS [webmasterworld.com] [/edit]

 

BlobFisk

WebmasterWorld Senior Member blobfisk us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 285 posted 12:50 pm on Jan 17, 2005 (gmt 0)

Welcome to WebmasterWorld, Nazgoth!

Could you post the code for the onchange event? Maybe it is a problem in the script that is causing the problem...

Nazgoth

5+ Year Member



 
Msg#: 285 posted 2:18 pm on Jan 17, 2005 (gmt 0)

The code for the combobox is as follows:

<?php
echo('<td colspan="2" align="right"><select name="select" class="combobox" onchange="disable_location(); submit_value(select.value,'.$HTTP_GET_VARS["lid"].');">'.$prop_types.'</select></td>')
?>

But the 2 javascript functions - disable_location() and submit_value() - are not being executed, which I think is because the onchange event not being triggered.

Nazgoth

5+ Year Member



 
Msg#: 285 posted 2:47 pm on Jan 17, 2005 (gmt 0)

Here's the javascript functions as well in case the problem is there.

function disable_location()
{
select2.disabled=true;
}

function submit_value(pid,lid)
{
var caminho=window.location.href;
window.location="index.php?pid="+pid+"&lid="+lid+"&prid=0&pag=1";
}

BlobFisk

WebmasterWorld Senior Member blobfisk us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 285 posted 2:48 pm on Jan 17, 2005 (gmt 0)

Have you tried escaping the characters in the script here:

<?php
echo('<td colspan="2" align="right"><select name="select" class="combobox" onchange="disable_location(); submit_value(select.value,'.$HTTP_GET_VARS["lid"].');">'.$prop_types.'</select></td>')
?>

I think the php quotes and JS quotes need to be escaped (especially the double quoteS)....

Birdman

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 285 posted 2:58 pm on Jan 17, 2005 (gmt 0)

Actually, the quotes look ok, except for one set. Since you surrounded youe echo string with singles, you should use singles in the $HTTP_GET_VARS array. Also, I believe you need a semicolon at the end of the echo. I could be wrong, since it's a one liner but just looking for probs.

<?php
error_reporting(E_ALL); // Crank up error reporting temporarily
echo('<td colspan="2" align="right"><select name="select" class="combobox" onchange="disable_location(); submit_value(select.value,'.$HTTP_GET_VARS[
'lid'].');">'.$prop_types.'</select></td>');
?>

Also, is the actual HTML output from the script what you intended it to be?

Blobfisk, the single quotes are being used for PHP concenation, rather than for enclosing a JS var. I'm assuming that var is a number, or else it will need another set of singles. And they would need escaping as you said above.

[edited by: Birdman at 3:04 pm (utc) on Jan. 17, 2005]

Nazgoth

5+ Year Member



 
Msg#: 285 posted 3:01 pm on Jan 17, 2005 (gmt 0)

I managed to fix the problem, in case anyone else is having the same problem... Apparently FF does not define name="select" but with id="select" it works fine...
Oh well, was only a couple of wasted hours trying to fix it lol

dcrombie

10+ Year Member



 
Msg#: 285 posted 5:06 pm on Jan 19, 2005 (gmt 0)

Where you have "select.value" you should actually be using:

options[selectedIndex].value

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Browsers / Firefox Browser Usage and Support
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved