![]() |
|
|
|||||||
![]() |
|
|
Thread Tools | Rate Thread |
|
|
PM User | #1 |
|
Regular Coder ![]() Join Date: Nov 2003
Location: mostly in Ann Arbor
Posts: 458
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
with an span named administration i have the following code.
administration.innerHTML = '<br><b><A CLASS="links" href="board.html">Board</A></b>'; this executes correctly. administration.innerHTML = '<br><li><A CLASS="links" href="board.html">Board</A></li>'; this code however does not execute correctly. i am wondering if there is a work around for changing HTML on the fly including adding list items and other fun formatting tags. |
|
|
|
|
|
PM User | #2 |
|
Banned ![]() Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
This works for me.
<script type="text/javascript"> function loadIt() { document.getElementById('administration').innerHTML = '<br><li><A CLASS="links" href="board.html">Board 1</A></li><li><A CLASS="links" href="board.html">Board 2</A></li><li><A CLASS="links" href="board.html">Board 3</A></li>'; } </script> </HEAD> <BODY onload="loadIt()"> <span ID="administration"></span> .....Willy |
|
|
|
|
|
PM User | #3 |
|
Regular Coder ![]() Join Date: Nov 2003
Location: mostly in Ann Arbor
Posts: 458
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
Half-fix
I tested your script in Netscape 7 and Mozilla (1.4 i think), but it still generates errors in IE6.
the error says that this line: document.getElementById('administration').innerHTML = '<br><li><A CLASS="links" href="board.html">Board 1</A></li><li><A CLASS="links" href="board.html">Board 2</A></li><li><A CLASS="links" href="board.html">Board 3</A></li>'; character 2 creates an unknown runtime error in IE. i've tried document.administration.innerHTML too. IE says document.administration.innerHTML is null or not an object. |
|
|
|
|
|
PM User | #5 |
|
Red Devil Mod ![]() ![]() Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 6,066
Thanks: 30
Thanked 143 Times in 139 Posts
![]() |
IE6 here, and the code works ok. It may be some empty spaces when copying the script... I use Dreamweaver and this editor unwraps automatically the code for avoiding this, but I think that copying in Notepad may give errors becouse of the wrapped lines...
__________________
KOR -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
|
|
|
|
|
PM User | #6 |
|
Regular Coder ![]() Join Date: Nov 2003
Location: mostly in Ann Arbor
Posts: 458
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
check http://www.bbaswim.org/~mburkebba/index.shtml i want the bullets to come down under Administration. when i click administration, i get a scrip error.
|
|
|
|
|
|
PM User | #7 |
|
Banned ![]() Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
No wonder it doesn't work!
What the heh is all of the additional spans? Code:
<script type="text/javascript">
function loadIt() {
document.getElementById('administration').innerHTML = '<li><A CLASS="links" href="board.html">Board 1</A></li>'; //'<br><span class="dot">l </span><br><span class="dot">l </span><A CLASS="links" href="board.html">Board 2</A><br><span class="dot">l </span><A CLASS="links" href="board.html">Board 3</A>';
}
</script>
solution as is, before you start making changes and then say it doesn't work. I don't have time at the moment to look into this any deeper. If you haven't fixed it, I'll try to look at it later when I have time. ......Willy |
|
|
|
|
|
PM User | #8 |
|
Banned ![]() Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
You can not put a SPAN inside a table data cell.
You will need to use CSS to position the elements of your page if you want continue to use this method. This works. Double Click closes the expanded span. Code:
<script type="text/javascript">
function loadIt() {
document.getElementById('administration').innerHTML = '<li><A CLASS="links" href="board.html">Board 1</A></li><li><A CLASS="links" href="board.html">Board 2</A></li><li><A CLASS="links" href="board.html">Board 3</A></li>';
}
function unloadIt() {
document.getElementById('administration').innerHTML ='';
}
</script>
</HEAD>
<BODY>
<a href="#" onclick="loadIt()" ondblclick="unloadIt()">Administration</a>
<span ID="administration"></span></P>
<P><A href="meets.html" class="big">Meets</A>
<LI><A CLASS="links" href="board.html">Board</A></LI>
<LI><A CLASS="links" href="coaches.html">Coaches</A></LI>
<LI><A CLASS="links" href="committee.html">Committee Chairs</A></LI>
<LI><A CLASS="links" href="communication.html">Communication</A></LI>
<LI><A CLASS="links" href="faqs.html">FAQs</A></LI>
<LI><A CLASS="links" href="m-schedule.html">Schedule</A></LI>
<LI><A CLASS="links" href="results.html">Results</A></LI>
<LI><A CLASS="links" href="entry.html">Entry Process</A></LI>
<LI><A CLASS="links" href="standards.html">Time Standards</A></LI></P>
<P><A href="member-handbook.html" class="big">Member Handbook</A>
<LI><A CLASS="links" href="parent-resp.html">Parent Responsibilities</A></LI>
<LI><A CLASS="links" href="records.html">Records</A></LI>
<LI><A CLASS="links" href="behavior.html">Swimmer Behavior</A></LI>
<LI><A CLASS="links" href="swimmer-resp.html">Swimmer Responsibilities</A></LI>
<LI><A CLASS="links" href="terms.html">Swimming Terms</A></LI>
<P><A href="practice-groups.html" class="big">Practice Groups</A>
<LI><A CLASS="links" href="descriptions.html">Descriptions</A></LI>
<LI><A CLASS="links" href="representatives.html">Representatives</A></LI>
<LI><A CLASS="links" href="p-schedule.html">Schedule</A></LI></P>
<P><A href="registration.html" class="big">Registration</A></P>
<P><A href="links.html" class="big">Swim Links</A></P>
|
|
|
|
|
|
PM User | #12 | ||
|
The thread killer ![]() ![]() Join Date: Feb 2003
Location: Umeå, Sweden
Posts: 5,575
Thanks: 0
Thanked 84 Times in 75 Posts
![]() |
Quote:
Quote:
__________________
liorean <[lio@wg]> Articles: RegEx evolt wsabstract , Named Arguments Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards Last edited by liorean; 11-26-2003 at 03:44 AM.. |
||
|
|
|
|
|
PM User | #13 |
|
Regular Coder ![]() Join Date: Nov 2003
Location: mostly in Ann Arbor
Posts: 458
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
the additional span tags are commented out. that method, by the way, does work. the li tags are the problem. when i try to set the 'administration' span to anything with an li tag in it, i get an error. and only in IE.
|
|
|
|
|
|
PM User | #14 |
|
Senior Coder ![]() Join Date: Jun 2002
Posts: 1,403
Thanks: 2
Thanked 31 Times in 31 Posts
![]() |
Not entirely sure what you're trying to do - but that 'unknown runtime error' is usually, in innerHTML-writing situations, a sign that you've attempted some invalid markup. Anyway, you've got list items without an <ul> or <ol> container...might try this:
Code:
....... <TD bgcolor="#0000CD" VALIGN="top"><BR> <P><a href="javascript:loadIt()" CLASS="big">Administration</a> <ul ID="administration"> </P> <P><A href="meets.html" class="big">Meets</A> <LI><A CLASS="links" href="board.html">Board</A></LI> <LI><A CLASS="links" href="coaches.html">Coaches</A></LI> ........ Code:
function loadIt()
{
var admin = document.getElementById('administration');
admin.innerHTML = '<li><a class="links" href="board.html">Board 1</a></li>' + admin.innerHTML;
}
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Rate This Thread | |
|
|