473,846 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FireFox & simple Javascript

Hi everybody

Wonder if you could help me out.

I created a simple JavaScript routine to enable a user to click backwards
and forwards between small news articles. This routine works fine in IE and
Safari, but in the latest FireFox I get no title or article, but do see the
prev and next links and the article number.

My HTML and JS simple routine is as follows:

<DIV CLASS="LatestNe wsTitle" ID="NewsTitle" NAME="NewsTitle ">&nbsp;</DIV>
<DIV CLASS="LatestNe wsText" ID="NewsText" NAME="NewsText" >&nbsp;</DIV>

<SPAN NAME="NewsPrev" ID="NewsPrev">< A HREF="JavaScrip t:void(0)"
OnClick="NewsNe xtPrev(thepage-=1)">Prev</A></SPAN>

<SPAN NAME="NewsNext" ID="NewsNext">< A HREF="javascrip t:void(0)"
OnClick="NewsNe xtPrev(thepage+ =1)">Next</A></SPAN>

<SCRIPT LANGUAGE="javas cript">
<!--
var thepage = 1;

var thePrevEnabled = '<A HREF="javascrip t:void(0)"
OnClick="NewsNe xtPrev(thepage-=1)">Prev</A>';
var thePrevDisabled = '&nbsp;';

var theNextEnabled = '<A HREF="javascrip t:void(0)"
OnClick="NewsNe xtPrev(thepage+ =1)">Next</A>';
var theNextDisabled = '&nbsp;';

var theTitleText = new Array(1);
var theParaText = new Array(1);
theTitleText[1]='';
theTitleText[1]+='e-mail warning';
theParaText[1]='';
theParaText[1]+='An e-mail from su*****@mydomai n.co.uk is not from us.';

function NewsStartText() {
self.NewsPrev.i nnerHTML = thePrevDisabled ;
self.NewsNext.i nnerHTML = theNextDisabled ;

self.NewsTitle. innerHTML = theTitleText[thepage];
self.NewsText.i nnerHTML = theParaText[thepage];
}

function NewsNextPrev(th epage) {
self.NewsPrev.i nnerHTML = thePrevDisabled ;
self.NewsNext.i nnerHTML = theNextDisabled ;
self.NewsTitle. innerHTML = theTitleText[thepage];
self.NewsText.i nnerHTML = theParaText[thepage];
return true;
}

NewsStartText()

//-->
</SCRIPT>

As it has stumped as to why Safari works OK and not FireFox when I thought
they 'fire off the same bat', do you have any idea as to what I'm doing
wrong?

Thanks

Robbie

PS: My Javascript functionality checkbox is ticked and it seems to be this
specific script rather than JS in general.

Jul 23 '05 #1
9 2129
Astra wrote:
Hi everybody

Wonder if you could help me out.

I created a simple JavaScript routine to enable a user to click backwards
and forwards between small news articles. This routine works fine in IE and
Safari, but in the latest FireFox I get no title or article, but do see the
prev and next links and the article number.

My HTML and JS simple routine is as follows:

<DIV CLASS="LatestNe wsTitle" ID="NewsTitle" NAME="NewsTitle ">&nbsp;</DIV>
<DIV CLASS="LatestNe wsText" ID="NewsText" NAME="NewsText" >&nbsp;</DIV>

<SPAN NAME="NewsPrev" ID="NewsPrev">< A HREF="JavaScrip t:void(0)"
OnClick="NewsNe xtPrev(thepage-=1)">Prev</A></SPAN>

<SPAN NAME="NewsNext" ID="NewsNext">< A HREF="javascrip t:void(0)"
OnClick="NewsNe xtPrev(thepage+ =1)">Next</A></SPAN>

<SCRIPT LANGUAGE="javas cript">
<!--
var thepage = 1;

var thePrevEnabled = '<A HREF="javascrip t:void(0)"
OnClick="NewsNe xtPrev(thepage-=1)">Prev</A>';
var thePrevDisabled = '&nbsp;';

var theNextEnabled = '<A HREF="javascrip t:void(0)"
OnClick="NewsNe xtPrev(thepage+ =1)">Next</A>';
var theNextDisabled = '&nbsp;';

var theTitleText = new Array(1);
var theParaText = new Array(1);
theTitleText[1]='';
theTitleText[1]+='e-mail warning';
theParaText[1]='';
theParaText[1]+='An e-mail from su*****@mydomai n.co.uk is not from us.';

function NewsStartText() {
self.NewsPrev.i nnerHTML = thePrevDisabled ;
self.NewsNext.i nnerHTML = theNextDisabled ;

self.NewsTitle. innerHTML = theTitleText[thepage];
self.NewsText.i nnerHTML = theParaText[thepage];
}

function NewsNextPrev(th epage) {
self.NewsPrev.i nnerHTML = thePrevDisabled ;
self.NewsNext.i nnerHTML = theNextDisabled ;
self.NewsTitle. innerHTML = theTitleText[thepage];
self.NewsText.i nnerHTML = theParaText[thepage];
return true;
}

NewsStartText()

//-->
</SCRIPT>

As it has stumped as to why Safari works OK and not FireFox when I thought
they 'fire off the same bat', do you have any idea as to what I'm doing
wrong?

Thanks

Robbie

PS: My Javascript functionality checkbox is ticked and it seems to be this
specific script rather than JS in general.

Robbie

To start NEVER use javascript: in the href of an anchor. Instead do the
following.

<a href="#" onclick="YourFu nctionCall(); return false">foo</a>

And I assume you are only using an anchor because it woks with the CSS
a:hover {} else you could have just used a span/div. Why? you ask hold
the shift key and click the link.

Also all tags and attribs should be in lower case.

change <SCRIPT LANGUAGE="javas cript"> to <script type="text/javascript">

I fail see why you are creating strings of html that for enabled and
disabled. You can just change the disabled property of the anchor.

Also can i suggest you use this to change the Text content of the div's

var eNewsText = document.getEle mentById("NewsT ext");
eNewsText.repla ceChild( document.create TextNode("The Content"),
eNewsText.first Child );

If you use propper DOM methods to reference and change the DOM you will
have ALOT less issues x-browser.

HTH
Andy

Jul 23 '05 #2
Astra wrote:
<snip>
<SPAN NAME="NewsPrev" ID="NewsPrev">
<A HREF="JavaScrip t:void(0)"
Executing a javascript pseudo-protocol HREF that does not replace the
current page is the scripting equivalent of kicking the browser really
hard. What will and will not function after you have done that is
anyone's guess. Web browsers are fragile, they should not be kicked.
OnClick="NewsNe xtPrev(thepage-=1)">Prev</A></SPAN>
If the onclick handler cancelled the navigation, by returning false, the
HREF would never be activated and so would not be able to have harmful
side effects. That would also make the contents of the HREF irrelevant
to script supporting browser, and available to facilitate fall-back for
script disabled browsers. It might, for example, contain the URL of the
pertinent news article proper so the script incapable/disabled browser
would navigate to that article (which seems quite an acceptable
fall-back in this situation) and it would even allow users to employ
that common context menu option of opening a link in a new browser
window (if they wanted to; giving the user the choice is good).

<snip> <SCRIPT LANGUAGE="javas cript">
In valid HTML 4 the TYPE attribute is required in a SCRIPT element, and
proving it renders the deprecated LANGUAGE attribute redundant.
<!--
The 'hide scripts from older browsers' stuff is for the benefit of
browser so old that nobody will still be using them (as they will not
function at all with any of the modern internet). Stop doing it.

<snip> function NewsNextPrev(th epage) {
self.NewsPrev.i nnerHTML = thePrevDisabled ;

<snip> ^^^^^^^^

The premise here is that a reference to an IDed DOM element is available
as a named property of the window object in web browsers. That is a
facility that Microsoft introduced, and others copied, but it is not
part of any formal specification and not implemented in numerous
browsers (including Mozilla/Firefox/Netscape/Gecko).

This is covered in this group's FAQ:-

<URL: http://www.jibbering.com/faq/ >

Richard.
Jul 23 '05 #3
Andrew Scott wrote:
<snip>
And I assume you are only using an anchor because it
woks with the CSS a:hover {} else you could have just
used a span/div. Why? you ask hold the shift key and
click the link.
It is not possible to keyboard navigate to a SPAN or a DIV [1], but it
is possible to keyboard navigate to an A element.

[1] Without providing a huge amount of additional code to monitor,
contextualise and respond to keyboard input.
Also all tags and attribs should be in lower case.

<snip>

HTML element names and attributes may be in any case, including mixed
case (and this is not an XHTML document, where lower case is required
for official XHTML DTD-specified element names and attributes).

Richard.
Jul 23 '05 #4
Down below :0)

"Andrew Scott" <An****@compan. net> wrote in message
news:11******** *****@corp.supe rnews.com...
Astra wrote:
Hi everybody

Wonder if you could help me out.

I created a simple JavaScript routine to enable a user to click backwards
and forwards between small news articles. This routine works fine in IE
and
Safari, but in the latest FireFox I get no title or article, but do see
the
prev and next links and the article number.

My HTML and JS simple routine is as follows:

<DIV CLASS="LatestNe wsTitle" ID="NewsTitle" NAME="NewsTitle ">&nbsp;</DIV>
<DIV CLASS="LatestNe wsText" ID="NewsText" NAME="NewsText" >&nbsp;</DIV>

<SPAN NAME="NewsPrev" ID="NewsPrev">< A HREF="JavaScrip t:void(0)"
OnClick="NewsNe xtPrev(thepage-=1)">Prev</A></SPAN>

<SPAN NAME="NewsNext" ID="NewsNext">< A HREF="javascrip t:void(0)"
OnClick="NewsNe xtPrev(thepage+ =1)">Next</A></SPAN>

<SCRIPT LANGUAGE="javas cript">
<!--
var thepage = 1;

var thePrevEnabled = '<A HREF="javascrip t:void(0)"
OnClick="NewsNe xtPrev(thepage-=1)">Prev</A>';
var thePrevDisabled = '&nbsp;';

var theNextEnabled = '<A HREF="javascrip t:void(0)"
OnClick="NewsNe xtPrev(thepage+ =1)">Next</A>';
var theNextDisabled = '&nbsp;';

var theTitleText = new Array(1);
var theParaText = new Array(1);
theTitleText[1]='';
theTitleText[1]+='e-mail warning';
theParaText[1]='';
theParaText[1]+='An e-mail from su*****@mydomai n.co.uk is not from us.';

function NewsStartText() {
self.NewsPrev.i nnerHTML = thePrevDisabled ;
self.NewsNext.i nnerHTML = theNextDisabled ;

self.NewsTitle. innerHTML = theTitleText[thepage];
self.NewsText.i nnerHTML = theParaText[thepage];
}

function NewsNextPrev(th epage) {
self.NewsPrev.i nnerHTML = thePrevDisabled ;
self.NewsNext.i nnerHTML = theNextDisabled ;
self.NewsTitle. innerHTML = theTitleText[thepage];
self.NewsText.i nnerHTML = theParaText[thepage];
return true;
}

NewsStartText()

//-->
</SCRIPT>

As it has stumped as to why Safari works OK and not FireFox when I thought
they 'fire off the same bat', do you have any idea as to what I'm doing
wrong?

Thanks

Robbie

PS: My Javascript functionality checkbox is ticked and it seems to be this
specific script rather than JS in general.

Robbie

To start NEVER use javascript: in the href of an anchor. Instead do the
following.

<a href="#" onclick="YourFu nctionCall(); return false">foo</a>

And I assume you are only using an anchor because it woks with the CSS
a:hover {} else you could have just used a span/div. Why? you ask hold
the shift key and click the link.

Also all tags and attribs should be in lower case.

change <SCRIPT LANGUAGE="javas cript"> to <script type="text/javascript">

I fail see why you are creating strings of html that for enabled and
disabled. You can just change the disabled property of the anchor.

Also can i suggest you use this to change the Text content of the div's

var eNewsText = document.getEle mentById("NewsT ext");
eNewsText.repla ceChild( document.create TextNode("The Content"),
eNewsText.first Child );

If you use propper DOM methods to reference and change the DOM you will
have ALOT less issues x-browser.

HTH
Andy

-----------------------------------

Hi Andy

Many thanks for the help. Having used the above getElement... I can now get
the title and text to appear OK, but I can't get my prev and next links to
work.

I've changed the anchors to:

<A HREF="#" OnClick="NewsNe xtPrev(thepage+ =1);return false">Next</A>
<A HREF="#" OnClick="NewsNe xtPrev(thepage-=1);return false">Prev</A>

and changed the JS to:

var eNewsPrev = document.getEle mentById("NewsP rev");
var eNewsNext = document.getEle mentById("NewsN ext");
eNewsPrev.repla ceChild(
document.create TextNode(thePre vDisabled),eNew sPrev.firstChil d );
eNewsNext.repla ceChild(documen t.createTextNod e(theNextEnable d),eNewsNext.fi rstChild);but all I appear to get is the HTML as standard plain text rather thanactually show the HTML, eg instead of showing a Next link I'm seeing <AHREF="#" OnClick="NewsNe xtPrev(thepage+ =1);return false">Next</A> on thepage.Can this not be done via getEleement.... ?What was this anchor disabling that you were talking about?All I want to do is enable/disable the Next and Prev links as and when thereare news 'pages' to see.Rgds Robbie

Jul 23 '05 #5
Richard Cornford wrote:
Andrew Scott wrote:
<snip>
And I assume you are only using an anchor because it
woks with the CSS a:hover {} else you could have just
used a span/div. Why? you ask hold the shift key and
click the link.

It is not possible to keyboard navigate to a SPAN or a DIV [1], but it
is possible to keyboard navigate to an A element.

[1] Without providing a huge amount of additional code to monitor,
contextualise and respond to keyboard input.

Also all tags and attribs should be in lower case.


<snip>

HTML element names and attributes may be in any case, including mixed
case (and this is not an XHTML document, where lower case is required
for official XHTML DTD-specified element names and attributes).

Richard.


Richard

Are suggesting that's the only reason Robbie used an anchor was to
enable keyboard navigation of the page?

To quote him "enable a user to click"

And indeed XHTML is the only DOCTYPE where case is a requirement. But
have said that it's always good to be consistant with the case.

And IMHO it's best to learn to use lowercase asap if ever the event
arises, which it did for me, that you need to change to use strict XHTML
DOCTYPE it's just a matter of changeing the DOCTYPE and ensuring the
arribs and elements are valid.

Reduce that tagsoup...

Andy

Jul 23 '05 #6
Andrew Scott wrote:
Richard Cornford wrote:
Andrew Scott wrote: <snip>
And I assume you are only using an anchor because it
woks with the CSS a:hover {} else you could have just
used a span/div. Why? you ask hold the shift key and
click the link.

It is not possible to keyboard navigate to a SPAN or a DIV
[1], but it is possible to keyboard navigate to an A element. <snip>
Also all tags and attribs should be in lower case.


<snip>

HTML element names and attributes may be in any case,
including mixed case (and this is not an XHTML document,
where lower case is required for official XHTML DTD-specified
element names and attributes).

<snip> Are suggesting that's the only reason Robbie used an anchor
was to enable keyboard navigation of the page?
I am pointing out that your proposed changes will result in a less
accessible outcome because it will not be useable via a keyboard, at
least not without considerable additional work.
To quote him "enable a user to click"
That the OP may have a pointing-device oriented mindset is not a good
reason for encouraging them to make changes that will potentially make
things worse for some visitors to their site. It is also possible that
the OP is living within a jurisdiction where a public information source
in the form of a web site must be accessible by law (like the UK).
And indeed XHTML is the only DOCTYPE where case is a
requirement. But have said that it's always good to
be consistant with the case.
Style advice can be given in a way that does not imply that its
conclusions are required or necessary. There are many things that
'should' or 'must' be done when authoring HTML, but using only lowercase
characters in element and attribute names is not one of them.
And IMHO it's best to learn to use lowercase asap if ever
the event arises, which it did for me, that you need to
change to use strict XHTML DOCTYPE it's just a matter of
changeing the DOCTYPE and ensuring the arribs and elements
are valid.
'Just a matter of changing the DOCTYPE'? You might just about get away
with that in an HTML newsgroup, but this is a scripting newsgroup and we
know that scripting XHTML involves using a different DOM, with its own
requirements, characteristics and idiosyncrasies and so that most
scripts would require large scale re-writing for use with XHTML.

But yes, most of us will not have to deal with XHTML for a long time as
we are working in a commercial context, where its use is made non-viable
by the predominance of IE 6.
Reduce that tagsoup...


You have set your own pit trap, are you now going to walk into it?

Richard.
Jul 23 '05 #7
Richard Cornford wrote:
Andrew Scott wrote:
Richard Cornford wrote:
Andrew Scott wrote:
<snip>
And I assume you are only using an anchor because it
woks with the CSS a:hover {} else you could have just
used a span/div. Why? you ask hold the shift key and
click the link.
It is not possible to keyboard navigate to a SPAN or a DIV
[1], but it is possible to keyboard navigate to an A element.
<snip>
Also all tags and attribs should be in lower case.

<snip>

HTML element names and attributes may be in any case,
including mixed case (and this is not an XHTML document,
where lower case is required for official XHTML DTD-specified
element names and attributes).


<snip>
Are suggesting that's the only reason Robbie used an anchor
was to enable keyboard navigation of the page?

I am pointing out that your proposed changes will result in a less
accessible outcome because it will not be useable via a keyboard, at
least not without considerable additional work.

To quote him "enable a user to click"

That the OP may have a pointing-device oriented mindset is not a good
reason for encouraging them to make changes that will potentially make
things worse for some visitors to their site. It is also possible that
the OP is living within a jurisdiction where a public information source
in the form of a web site must be accessible by law (like the UK).

And indeed XHTML is the only DOCTYPE where case is a
requirement . But have said that it's always good to
be consistant with the case.

Style advice can be given in a way that does not imply that its
conclusions are required or necessary. There are many things that
'should' or 'must' be done when authoring HTML, but using only lowercase
characters in element and attribute names is not one of them.

And IMHO it's best to learn to use lowercase asap if ever
the event arises, which it did for me, that you need to
change to use strict XHTML DOCTYPE it's just a matter of
changeing the DOCTYPE and ensuring the arribs and elements
are valid.

'Just a matter of changing the DOCTYPE'? You might just about get away
with that in an HTML newsgroup, but this is a scripting newsgroup and we
know that scripting XHTML involves using a different DOM, with its own
requirements, characteristics and idiosyncrasies and so that most
scripts would require large scale re-writing for use with XHTML.

But yes, most of us will not have to deal with XHTML for a long time as
we are working in a commercial context, where its use is made non-viable
by the predominance of IE 6.

Reduce that tagsoup...

You have set your own pit trap, are you now going to walk into it?

Richard.


Richard

Your points are are 100% valid and i must agree with all of them.

And rereading my statment about case of tag I feel that i did sound a
touch forthright and maybe i should have said "Can i suggest you use
lowercase for tags and attribs, if only for easy of reading". Tell me
what case do you use?

Andy

Jul 23 '05 #8
Down below :0)

"Richard Cornford" <Ri*****@litote s.demon.co.uk> wrote in message
news:d8******** ***********@new s.demon.co.uk.. .
Astra wrote:
<snip>
<SPAN NAME="NewsPrev" ID="NewsPrev">
<A HREF="JavaScrip t:void(0)"
Executing a javascript pseudo-protocol HREF that does not replace the
current page is the scripting equivalent of kicking the browser really
hard. What will and will not function after you have done that is
anyone's guess. Web browsers are fragile, they should not be kicked.
OnClick="NewsNe xtPrev(thepage-=1)">Prev</A></SPAN>
If the onclick handler cancelled the navigation, by returning false, the
HREF would never be activated and so would not be able to have harmful
side effects. That would also make the contents of the HREF irrelevant
to script supporting browser, and available to facilitate fall-back for
script disabled browsers. It might, for example, contain the URL of the
pertinent news article proper so the script incapable/disabled browser
would navigate to that article (which seems quite an acceptable
fall-back in this situation) and it would even allow users to employ
that common context menu option of opening a link in a new browser
window (if they wanted to; giving the user the choice is good).

<snip> <SCRIPT LANGUAGE="javas cript">
In valid HTML 4 the TYPE attribute is required in a SCRIPT element, and
proving it renders the deprecated LANGUAGE attribute redundant.
<!--
The 'hide scripts from older browsers' stuff is for the benefit of
browser so old that nobody will still be using them (as they will not
function at all with any of the modern internet). Stop doing it.

<snip> function NewsNextPrev(th epage) {
self.NewsPrev.i nnerHTML = thePrevDisabled ;

<snip> ^^^^^^^^

The premise here is that a reference to an IDed DOM element is available
as a named property of the window object in web browsers. That is a
facility that Microsoft introduced, and others copied, but it is not
part of any formal specification and not implemented in numerous
browsers (including Mozilla/Firefox/Netscape/Gecko).

This is covered in this group's FAQ:-

<URL: http://www.jibbering.com/faq/ >

Richard.
Dear Andrew/Richard

Thanks for the feedback.

I've tried the innerHTML, but it doesn't seem to kick in, eg:

By default my HTML code now looks like:

<SPAN NAME="NewsPrev" ID="NewsPrev">< A HREF="#"
OnClick="NewsNe xtPrev(thepage-=1);return false">Prev</A></SPAN>

in my JS code I set the following vars:

var thePrevEnabled = '<A HREF="#" OnClick="NewsNe xtPrev(thepage-=1);return
false"><IMG SRC="skins/<%=cSkinsFolder Name%>/btn-prev.jpg" BORDER=0></A>';

var thePrevDisabled = '<A HREF="#"><IMG
SRC="skins/<%=cSkinsFolder Name%>/btn-prev-disabled.jpg" BORDER=0></A>';

further down the JS code I've set a literal test of:

document.getEle mentById("NewsP rev").InnerHTM L = "fred";

but nothing happens.

Having changed all the self's to getElementByIDs , my text actually works,
eg:

var eNewsText = document.getEle mentById("NewsT ext");
eNewsText.repla ceChild(documen t.createTextNod e(theParaText[thepage]),eNewsText.fir stChild);

now cycles through the text although HTML tags also appear as plain text as
well!!

If I used the style.visibilit y command line to show/hide the
disabled/enabled status then the whole thing works fine, but I want to show
an enabled/disabled button instead of nothing.

Can you help me get this InnerHTML to kick in.

Thanks

Robbie

Jul 23 '05 #9
false alarm!!

wasn't careful enough with my casing > InnerHTML should be innerHTML.

All sorted now.

Thanks

Robbie
"Astra" <No@Spam.com> wrote in message
news:11******** *****@corp.supe rnews.com...
Down below :0)

"Richard Cornford" <Ri*****@litote s.demon.co.uk> wrote in message
news:d8******** ***********@new s.demon.co.uk.. .
Astra wrote:
<snip>
<SPAN NAME="NewsPrev" ID="NewsPrev">
<A HREF="JavaScrip t:void(0)"
Executing a javascript pseudo-protocol HREF that does not replace the
current page is the scripting equivalent of kicking the browser really
hard. What will and will not function after you have done that is
anyone's guess. Web browsers are fragile, they should not be kicked.
OnClick="NewsNe xtPrev(thepage-=1)">Prev</A></SPAN>
If the onclick handler cancelled the navigation, by returning false, the
HREF would never be activated and so would not be able to have harmful
side effects. That would also make the contents of the HREF irrelevant
to script supporting browser, and available to facilitate fall-back for
script disabled browsers. It might, for example, contain the URL of the
pertinent news article proper so the script incapable/disabled browser
would navigate to that article (which seems quite an acceptable
fall-back in this situation) and it would even allow users to employ
that common context menu option of opening a link in a new browser
window (if they wanted to; giving the user the choice is good).

<snip> <SCRIPT LANGUAGE="javas cript">
In valid HTML 4 the TYPE attribute is required in a SCRIPT element, and
proving it renders the deprecated LANGUAGE attribute redundant.
<!--
The 'hide scripts from older browsers' stuff is for the benefit of
browser so old that nobody will still be using them (as they will not
function at all with any of the modern internet). Stop doing it.

<snip> function NewsNextPrev(th epage) {
self.NewsPrev.i nnerHTML = thePrevDisabled ;

<snip> ^^^^^^^^

The premise here is that a reference to an IDed DOM element is available
as a named property of the window object in web browsers. That is a
facility that Microsoft introduced, and others copied, but it is not
part of any formal specification and not implemented in numerous
browsers (including Mozilla/Firefox/Netscape/Gecko).

This is covered in this group's FAQ:-

<URL: http://www.jibbering.com/faq/ >

Richard.
Dear Andrew/Richard

Thanks for the feedback.

I've tried the innerHTML, but it doesn't seem to kick in, eg:

By default my HTML code now looks like:

<SPAN NAME="NewsPrev" ID="NewsPrev">< A HREF="#"
OnClick="NewsNe xtPrev(thepage-=1);return false">Prev</A></SPAN>

in my JS code I set the following vars:

var thePrevEnabled = '<A HREF="#" OnClick="NewsNe xtPrev(thepage-=1);return
false"><IMG SRC="skins/<%=cSkinsFolder Name%>/btn-prev.jpg" BORDER=0></A>';

var thePrevDisabled = '<A HREF="#"><IMG
SRC="skins/<%=cSkinsFolder Name%>/btn-prev-disabled.jpg" BORDER=0></A>';

further down the JS code I've set a literal test of:

document.getEle mentById("NewsP rev").InnerHTM L = "fred";

but nothing happens.

Having changed all the self's to getElementByIDs , my text actually works,
eg:

var eNewsText = document.getEle mentById("NewsT ext");
eNewsText.repla ceChild(documen t.createTextNod e(theParaText[thepage]),eNewsText.fir stChild);

now cycles through the text although HTML tags also appear as plain text as
well!!

If I used the style.visibilit y command line to show/hide the
disabled/enabled status then the whole thing works fine, but I want to show
an enabled/disabled button instead of nothing.

Can you help me get this InnerHTML to kick in.

Thanks

Robbie


Jul 23 '05 #10

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

Similar topics

6
1999
by: christian9997 | last post by:
Hi I would be very helpful if someone could help me with this code. It works fine in IE but when I display it in Netscape or Firefox and I move the mouse from one menu to the other the gap between the two menus gets bigger. What is the cause of this? Thanks CODE:
4
1472
by: L2XL | last post by:
I have an ASP.NET (VB) app that I created for the Windows and IE6 enviroment. When it runs under Firefox on Windows it looks similar but has some display issues. When I run it under Firefox on Linix it has the same issues as Firefox on Windows, plus it has font display issues. I have only worked with Windows and IE6 and haven't tried supporting additional browsers or systems on this website. Does anyone have any suggestions on how to...
12
6189
by: PMA | last post by:
Hi all, I am porting a web application from IE 6.0 to FireFox 1.5. I have solved almost all compatibility issues (quite a lot but not too bad) except two of them : 1) Clipboard access thru' JavaScript (programmatical copy and paste actions) 2) Monitoring and driving Insert/Overwrite mode on input fields
6
4042
by: laramie.hartmann | last post by:
I have a script (see below) that accesses a XML file and displays the contents through a series of document.write calls. This all works fine in IE, but not at all in Firefox. I get no errors in the javascript console, but when I try to load the elements by tag name and look at the length it is always 0 as if no elements have been added. Any suggestions are greatly appreciated as I've been stuck on this for a while now. Thanks,
6
2042
by: smoitra | last post by:
Hi All, I am new here.I have a textbox in my form where user is supposed to enter zip codes and as soon they enter that and press tab or click elsewhere on the form it is supposed to go to javascript function called UpdateCityState which takes that textbox as object and updates City and State Values.The code is <asp:textbox id="txtZip" onkeydown="if ((event.which &amp;&amp; event.which == 13) || (event.keyCode &amp;&amp; event.keyCode == 13))...
22
2807
by: giordan | last post by:
Hi all! I've wrote this code: <script type="text/javascript"> var largImg; var altImg; var txtTop = '<b>Ottima scelta!</b> Ora compila il form e premi "Ricevi banner". Il codice HTML ti verrà mostrato in questa pagina e, per comodità, ti verrà inviato, via mail, all\'indirizzo da te fornito. Se invece vuoi cambiare il banner premi "Seleziona banner"'; var txtButton = 'Cambia banner'; var testo = '';
1
4235
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being aligned to the top, along with the slideshow and link buttons, you have to scroll down to see the text - how can I make IE6 display correctly? http://geekarama.co.uk/new_home.html here is the code for new_home.html and following that the CSS...
3
2441
by: SAL | last post by:
Hello, I did google this issue and found some stuff related to BrowserCaps section of either web.config or machine.config but it didn't work. It seems that most pages in my webapp are okay but a couple of the Firefox is munging up. So, on my information page there is a gridview in the content section of the page. The masterpage contains searching capabilities for the gridview. The masterpage has controls contained in a panel control,...
0
9879
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10978
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10643
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10705
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7879
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7050
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5716
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4113
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.