Jump to content

Firefox Problem


jug

Recommended Posts

This is not totally PHP but is related.

I have a page which works in IE but not in Firefox, the page basically does the following:

PHP Script outputs several images onto my page, and each of them have a unique id (from a mysql database) stored in the id tag. I have a javascript function which is called on mouse over of each image. This function gets the value of the id tag and display in a table below my images.

In IE, this works, but in Firefox, the data isn't displayed in the table when I hover over the images.

I'm guessing one of the features i'm using is not compatible with Firefox, can anyone tell me what it is and how I can overcome it.

Thanks in advance

Regards

Jug
Link to comment
https://forums.phpfreaks.com/topic/30620-firefox-problem/
Share on other sites

function GetDetails()
{
var DetailsAll = window.event.srcElement.id;
var WhereSpaceIs = DetailsAll.indexOf(" ")
var NamePart = DetailsAll.substr(0, WhereSpaceIs)
var AgePart = DetailsAll.substr(WhereSpaceIs)
document.getElementById("NameDisplay").innerHTML = NamePart
document.getElementById("AgeDisplay").innerHTML = AgePart
}

Basically I've got the name and age in the id tag and i'm separating them with a bit of string handling and displaying them in a table.
Link to comment
https://forums.phpfreaks.com/topic/30620-firefox-problem/#findComment-141022
Share on other sites

I cant really test it out without your HTML too, so I suggest a [url=http://www.google.com/search?sourceid=navclient-ff&ie=UTF-8&rls=GGGL,GGGL:2006-22,GGGL:en&q=firefox+window.event]google search for "firefox window.event"[/url]

You will find google can help you out with most of these compatibilty issues, just search for firefox + the error
Link to comment
https://forums.phpfreaks.com/topic/30620-firefox-problem/#findComment-141268
Share on other sites

  • 1 month later...
So can anyone suggest what the following code has to be to be cross-browser?

[b]Javascript Functions:[/b]

function GetDetails()
{
var DetailsAll = window.event.srcElement.id;
var WhereSpaceIs = DetailsAll.indexOf(" ")
var NamePart = DetailsAll.substr(0, WhereSpaceIs)
var AgePart = DetailsAll.substr(WhereSpaceIs)
document.getElementById("NameDisplay").innerHTML = NamePart
document.getElementById("AgeDisplay").innerHTML = AgePart
}

function GetDetailsRevert()
{
document.getElementById("NameDisplay").innerHTML = " "
document.getElementById("AgeDisplay").innerHTML = " "
}

[b]Each image has the following tags[/b]

<img id="' . $Variable .'" onMouseOver="GetDetails()" onMouseOut="GetDetailsRevert()" src="image.jpg">

[b]And the table where I display the data about the current image has these spans[/b]

<span id="NameDisplay">
<span id="AgeDisplay">




Thanks in advance

Regards

Jug
Link to comment
https://forums.phpfreaks.com/topic/30620-firefox-problem/#findComment-166313
Share on other sites

to make the event information accessable cross browser, use this template:
[code]element.onclick = doSomething;

function doSomething(e) {
if (!e) var e = window.event;
// e gives access to the event in all browsers
}[/code]
http://www.quirksmode.org/js/events_access.html
everything your mother never told you about js events:
http://www.quirksmode.org/js/introevents.html
Link to comment
https://forums.phpfreaks.com/topic/30620-firefox-problem/#findComment-166646
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.