TeamPhotoshop
Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
Forum Home Latest Posts Search Help Subscribe

Problems With JavaScript

Page: 1 Reply
Mar 23rd 2004#146139 Report
Member since: Feb 6th 2003
Posts: 14
Having some problems getting this script to work on Mozilla and NetScape. Have a look see if you can help me:

[CODE]
// set link messages
function upStatus(x) {
var link_text = new Array();
link_text[0] = ""; // default message
link_text[1] = "Message 1";
link_text[2] = "Message 2";
link_text[3] = "Message 3";
link_text[4] = "Message 4";
link_text[5] = "Message 5";
link_text[6] = "Message 6";

linkMessages.innerText = link_text[x];
setTimeout("clear_status()", 1000);
}

// clear page status
function clear_status() {
window.status = "";
}
[/CODE]

Thanks...
Reply with Quote Reply
Mar 23rd 2004#146145 Report
Member since: May 22nd 2003
Posts: 315
setTimeout("clear_status()", 1000);

you have the timeout going for one milisecond... the counters work in miliseconds so make it 1000 and you've got a second :D
Reply with Quote Reply
Mar 23rd 2004#146151 Report
Member since: Feb 6th 2003
Posts: 14
Yeah, but that doesn't make any difference to the script not running on Mozilla or NetScape...

It could be something to do with the way it is called from the page:

[CODE]
<a href="myLink.html" onmouseover="upStatus(1)" onmouseout="upStatus(0)">My Link</a>
[/CODE]
Reply with Quote Reply
Mar 25th 2004#146306 Report
Member since: May 22nd 2003
Posts: 315
try changing it to onMouseover? I don't know really beside what I suggested, all I know is that '1' for a set timeout isn't even a noticeable amount of time...
Reply with Quote Reply
Mar 25th 2004#146329 Report
Member since: Feb 6th 2003
Posts: 14
I'm not sure "onMouseover" will do anything, due to it being XHTML 1.0 Standard that it should be "onmouseover".

Thanks for your help anyway.
Reply with Quote Reply
Mar 25th 2004#146335 Report
Member since: May 1st 2002
Posts: 3034
// set link messages
function upStatus(x)

do you need the x ? O_o and maybe make the S lowercase.
Reply with Quote Reply
Mar 25th 2004#146349 Report
Member since: Nov 26th 2001
Posts: 2586
linkMessages.innerText


My best guess is this is not supported by Netscape or Mozilla (or Opera most likely). innerText, outerText, innerHTML, outerHTML are an IE thing (and it's depracated....) - Google is your friend.
Reply with Quote Reply
Mar 26th 2004#146381 Report
Member since: Feb 6th 2003
Posts: 14
Maybe, but i'm not sure how I would call it without using "innerText".
Reply with Quote Reply
Mar 26th 2004#146384 Report
Member since: Nov 26th 2001
Posts: 2586
Quote Myself:
Google is your friend


I saw some examples, but you'd have to write several, depending on which browser.


From Mozilla's site (*where if you search a browsers site you can find out what javascript it supports*)

The following element properties (originally from Internet Explorer) are likewise not supported in the W3C Document Object Model:

element.innerText
element.innerHTML (supported by Gecko)
element.outerText
element.outerHTML
Scripts that use these properties will not execute in Netscape 6/7 or other standards-compliant browsers. Instead, use the DOM access methods described in the next section. Also see Manipulating Document Style and Content for examples of using the DOM to access style rules


So it says that it supports innerHTML (as well does NS6+)....

This link will tell you a little bit more about what you need to do:
http://www.mozilla.org/docs/web-developer/upgrade_2.html#deprec
Reply with Quote Reply
Mar 26th 2004#146422 Report
Member since: Feb 6th 2003
Posts: 14
Just sorted it. Thanks at lot for your help. :D

[CODE]
function upStatus(x) {
var link_text = new Array();
link_text[0] = ""; // default message
link_text[1] = "Back to Home Page...";
link_text[2] = "About MetaGraphical Web Studios...";
link_text[3] = "What can MetaGraphical do for You?";
link_text[4] = "Portfolio of Work...";
link_text[5] = "MetaGraphical Artwork...";
link_text[6] = "Contact MetaGraphical...";

document.getElementById("linkMessages").innerHTML = link_text[x];
setTimeout("clear_status()", 1000);
}
[/CODE]
Reply with Quote Reply
Page: 1 Back to top
Please login or register above to post in this forum