Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Firefox Javascript problem
Old 05-22-2008, 09:27 AM Firefox Javascript problem
Junior Talker

Posts: 3
Name: Izak
Trades: 0
Hello!

I'm running the following script in IE7, working perfectly.

For some reason, I can't get it to work in Firefox!

Please help!

function appendDIV(objID,newID)
{
// create a DIV element, using the variable eDIV as a reference to it
eDIV = document.createElement("div");
//use the setAttribute method to assign it an id
eDIV.setAttribute("id",newID);
// append your newly created DIV element to an already existing element.
document.getElementById(objID).appendChild(eDIV);
}

function clearInnerHTML(objID)
{
var obj = document.getElementById(objID);
while(obj.firstChild) obj.removeChild(obj.firstChild);
}

function mbtn_select(e)
{
var targ;
var currentpage = "esc";

if (!e) var e = window.event;
if (e.targ) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3)
targ = targ.parentNode;

var parentBox = targ.parentNode;
var btn_text=targ.firstChild.nodeValue;
var pagename = currentpage + btn_text + ".aspx";

window.location = pagename;

}
izakcrafford is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-23-2008, 09:53 PM Re: Firefox Javascript problem
logic ali's Avatar
Super Talker

Posts: 104
Trades: 0
Quote:
Code:
      if (e.targ) targ = e.target;
    else if (e.srcElement) targ = e.srcElement;
Should be e.target, but the entire statement above can be written as:
Code:
targ = e.target || e.srcElement;
logic ali is offline
Reply With Quote
View Public Profile
 
Old 05-29-2008, 07:32 AM Re: Firefox Javascript problem
Junior Talker

Posts: 3
Name: Izak
Trades: 0
done that. Gives me a quicker response time in IE, but still doesn't pick up that the text should be seen as hyperlinks.

The aspx/css that references the script is:

<div class="Menu_Button" onclick="mbtn_select(event)"> Overview</div>
<div class="Menu_Button" onclick="mbtn_select(event)">
Specs</div>

so when the user clicks on "Overview" it redirects to in this case "escOverview.aspx"
izakcrafford is offline
Reply With Quote
View Public Profile
 
Old 05-29-2008, 07:42 AM Re: Firefox Javascript problem
Junior Talker

Posts: 3
Name: Izak
Trades: 0
thanks, that sped the process in IE7, but still not working in Firefox.

The problem is, it doesn't let my text respond as hyperlinks.

The aspx/css that accompanies this script is:

<divclass="Menu_Button"onclick="mbtn_select(event)">
Overview</div>
<divclass="Menu_Button"onclick="mbtn_select(event)">
Specs</div>

So in this case, if the user clicks on Overview, it displays as a button, and redirects to "escOverview.aspx"
izakcrafford is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Firefox Javascript problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.48635 seconds with 12 queries