|
need help with javascript Hide and Show Codeing
05-22-2009, 06:43 AM
|
need help with javascript Hide and Show Codeing
|
Posts: 14
Location: UK,England,Essex
|
hi all i cloud really need some help with this coding i dont know why it isnt working it should be on load Hidden text but it shows all text on load can you guys and girls take a look at my coding and work out where i went wrong thxs or fix it for me big thxs in adv
the file i added a zip that contans the html code ,java,css that makes it all work what
Last edited by burnsyy; 05-22-2009 at 10:30 AM..
|
|
|
|
05-22-2009, 10:29 AM
|
Re: need help with javascript Hide and Show Codeing
|
Posts: 14
Location: UK,England,Essex
|
can any 1 please help kinda need this asap and i dont really want to result to html verson of it
|
|
|
|
05-22-2009, 10:47 AM
|
Re: need help with javascript Hide and Show Codeing
|
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
People tend not to open zip files. Do you have a link to the page?
|
|
|
|
05-22-2009, 11:15 AM
|
Re: need help with javascript Hide and Show Codeing
|
Posts: 14
Location: UK,England,Essex
|
Quote:
Originally Posted by wayfarer07
People tend not to open zip files. Do you have a link to the page?
|
no its not live yet ive put it on notepads
Last edited by burnsyy; 05-22-2009 at 11:18 AM..
|
|
|
|
05-26-2009, 10:17 AM
|
Re: need help with javascript Hide and Show Codeing
|
Posts: 14
Location: UK,England,Essex
|
ok am bumping this because i really need sum help all i need is sum 1 to look at the coding at tell me how to get the text to be hidden on load untill the link has been clicked
This is the CSS
Code:
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #CCCCCC;
}
p {
margin-bottom: 10px;
margin-top: 0px;
}
/*Fonts*/
.a11 {
font-family: Arial, Helvetica, sans-serif;
color: #45717D;
font-size: 11px;
text-decoration: none;
}
.a11text {
font-family: Arial, Helvetica, sans-serif;
color: #333333;
font-size: 11px;
text-decoration: none;
}
.a11white {
font-family: Arial, Helvetica, sans-serif;
color: #FFFFFF;
font-size: 11px;
text-decoration: none;
}
.a12 {
font-family: Arial, Helvetica, sans-serif;
color: #FFFFFF;
font-size: 12px;
text-decoration: none;
}
.a12k {
font-family: Arial, Helvetica, sans-serif;
color: #000000;
font-size: 12px;
text-decoration: none;
}
.a13 {
font-family: Arial, Helvetica, sans-serif;
color: #45717D;
font-size: 13px;
text-decoration: none;
}
.web-number {
font-family: Arial, Helvetica, sans-serif;
color: #45717D;
font-size: 15px;
}
.a14 {
font-family: Arial, Helvetica, sans-serif;
color: #3C626C;
font-size: 14px;
text-decoration: none;
font-weight: bold;
}
.a12b {
font-family: Arial, Helvetica, sans-serif;
color: #4B7C89;
font-size: 12px;
text-decoration: none;
font-weight: bold;
}
/*Links*/
.a11link {
font-family: Arial, Helvetica, sans-serif;
color: #026BA4;
font-size: 11px;
text-decoration: none;
}
.a12link {
font-family: Arial, Helvetica, sans-serif;
color: #000000;
font-size: 12px;
text-decoration: none;
}
/*a:hover {
border-right-style: solid;
border-left-style: solid;
padding-right: 9px;
padding-left: 9px;
border-right-width: 1px;
border-left-width: 1px;
border-right-color: #FCFEFE;
border-left-color: #FCFEFE;
background-image: url(cisco-training-courses-images/boarder.gif);
}*/
a:hover {
text-decoration: underline;
}
/*Fields*/
.training-field-sm {
height: 16px;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
margin: 0px;
border-top-width: 1px;
border-right-width: 2px;
border-bottom-width: 2px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #666666;
border-right-color: #E1E1E1;
border-bottom-color: #E1E1E1;
border-left-color: #666666;
background-color: #DCE9E8;
color: #444444;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 2px;
}
.training-field-smw {
height: 16px;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
margin: 0px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #666666;
border-right-color: #E1E1E1;
border-bottom-color: #E1E1E1;
border-left-color: #666666;
color: #444444;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 2px;
}
.training-field-sm-comments {
border: 1px solid #666666;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
}
.training-field-sm1 {
height: 18px;
border: 1px solid #666666;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
}
.training-field-sm-comments1 {
border: 1px solid #666666;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
}
.signon {
border: 1px solid #799390;
height: 17px;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
width: 50px;
background-image: url(online-training-courses-images/cisco-signon.jpg);
color: 45717D;
font-weight: bold;
padding-bottom: 1px;
}
.program-submit-button {
border: 1px solid #799390;
height: 17px;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
width: 110px;
background-image: url(online-training-courses-images/cisco-signon.jpg);
color: 45717D;
font-weight: bold;
padding-bottom: 1px;
}
input.web-blackboard-name {
border:0;
font-family: "Bradley Hand ITC";
font-size: 18px;
color: #E1717F;
width: 224px;
height: 22px;
background-image: url(online-training-courses-images/ccna-name.jpg);
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 3px;
background-color: #1F1617;
background-attachment: ;
background-position: right top;
margin: 0px;
text-indent: 2px;
}
input.web-blackboard-e-mail {
border:0;
font-family: "Bradley Hand ITC";
font-size: 18px;
color: #E1717F;
width: 253px;
height: 22px;
background-image: url(online-training-courses-images/ccna-e-mail.jpg);
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 4px;
background-color: #1F1617;
background-attachment: ;
background-position: right bottom;
margin: 0px;
text-indent: 4px;
}
input.web-blackboard-phone {
border:0;
font-family: "Bradley Hand ITC";
font-size: 18px;
color: #E1717F;
width: 228px;
height: 22px;
background-image: url(online-training-courses-images/ccna-phone.jpg);
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 4px;
background-color: #1F1617;
background-attachment: ;
background-position: right bottom;
margin: 0px;
text-indent: 4px;
}
input.web-blackboard-comment {
border:0;
font-family: "Bradley Hand ITC";
font-size: 18px;
color: #B6D4EC;
width: 318px;
height: 22px;
background-image: url(online-training-courses-images/ccna-comment.jpg);
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 4px;
background-color: #1F1617;
background-attachment: ;
background-position: right bottom;
margin: 0px;
text-indent: 2px;
}
.a143bg {
border: none;
width: 95px;
height: 18px;
font-size: 11px;
display: block;
float: left;
background: url(online-images/header_input_text.gif);
background-repeat: no-repeat;
padding-left: 8px;
background-image: url(online-images/header_input_text.gif);
padding-top: 3px;
border-style: none;
}
.a143A {
border: none;
width: 88px;
height: 17px;
font-size: 11px;
display: block;
float: left;
background-repeat: no-repeat;
background: url(online-images/header_input_text.gif);
margin-right: 10px;
padding-right: 10px;
}
.blacklineleft.right {
background-image: url(online-images/blacklineleft&right.gif);
}
.a1 {
font-size: 1px;
color: #666666;
}
#container {
min-height:100%;
}
* html #container {
height:100%; /* lte IE6 treats height as min-height */
}
h1 {
font:bold 200%/140% arial,helvetica,sans-serif;
background:#DEF;
border-bottom:2px solid #000;
margin-bottom:8px;
}
h2 {
text-align:center;
font:bold 150%/140% arial,helvetica,sans-serif;
}
p {
padding:0.5em;
}
#setContainer {
width:466px;
margin:0 auto;
text-align:left;
}
/*
I very rarely advocate using !important, but given the above margins are set
via an ID for when .js is off, this is the simplest answer.
*/
.s_control {
padding:0 !important;
display:hidden !important;
}
.s_control a {
display:block;
height:24px;
padding:2px 8px;
position:relative;
text-decoration:none;
}
.s_control a span {
position:absolute;
top:6px;
right:8px; /* half pixel stops gecko from firefuxing up position*/
width:12px;
height:16px;
font-size:1px; /* keep IE happy */
background:url(file:///C|/Users/Danny/AppData/Local...es/buttons.gif) 0 -16px no-repeat;
}
.sc_shrunk a span {
background-position:0 0;
}
.sc_shrinking a span {
background-position:-12px -16px;
}
.sc_expanding a span {
background-position:-12px 0;
}
.sc_shrinking,
.sc_expanding {
background:#EEF;
}
.s_content {
background:#E8F0F8;
border:solid #000;
border-width:0 2px 2px;
overflow:hidden;
margin-bottom:8px;
font:normal 12px/16px arial,helvetica,sans-serif;
}
.s_content.s_shrunk {
border-bottom:0;
}
#textContentWrap {
margin:0 auto;
min-width:460px;
max-width:460px;
text-align:left;
padding-bottom:42px; /* make room for footer */
}
* html #textContentWrap {
width:460px; /* if scripting is off, fix the width to 800 friendly */
width:expression(
(document.body.clientWidth>996) ? "996px"
: ((document.body.clientWidth>766) ? "auto" : "768px")
);
}
#textContent_sControl {
clear:both;
height:32px;
padding:4px 0 4px;
font:bold 22px/32px arial,helvetica,sans-serif;
}
#textContent_sControl a span {
position:relative;
display:-moz-inline-block;
display:-moz-inline-box;
display:inline-block;
top:0;
right:-8px;
vertical-align:middle;
}
#textContent {
overflow:hidden;
}
This is JS
Code:
var boxMoveDivider=8;
var boxMoveMinimum=4;
var boxInterval=30;
var boxArray=new Array();
var boxTimerActive=0;
function boxTimer() {
boxTimerActive=0;
for (t=0; t<boxArray.length; t++) {
if (boxArray[t].className.indexOf('s_expanding')!=-1) {
total=boxArray[t].offsetHeight + (
Math.floor(boxArray[t].offsetHeight/boxMoveDivider) +
boxMoveMinimum
);
if (total>=boxArray[t].scrollHeight) {
total=boxArray[t].scrollHeight;
boxArray[t].className=boxArray[t].className.replace(/s_expanding/,'s_expanded');
control=document.getElementById(boxArray[t].id+'_sControl');
control.className=control.className.replace(/sc_expanding/,'sc_expanded');
} else boxTimerActive++;
boxArray[t].style.height=total+'px';
} else if (boxArray[t].className.indexOf('s_shrinking')!=-1) {
total=boxArray[t].offsetHeight - (
Math.floor(boxArray[t].offsetHeight/boxMoveDivider) +
boxMoveMinimum
);
if (total<=0) {
total=0;
boxArray[t].className=boxArray[t].className.replace(/s_shrinking/,'s_shrunk');
control=document.getElementById(boxArray[t].id+'_sControl');
control.className=control.className.replace(/sc_shrinking/,'sc_shrunk');
} else boxTimerActive++;
boxArray[t].style.height=total+'px';
}
}
if (boxTimerActive>0) setTimeout(boxTimer,boxInterval);
}
function checkRadio(target) {
radioNumber=target.className.match(/\bs_radio\w+\b/);
if (radioNumber) {
for (t=0; t<boxArray.length; t++) {
cName=boxArray[t].className;
if ((boxArray[t]!=target) && (cName.indexOf(radioNumber)!=-1)) {
control=document.getElementById(boxArray[t].id+'_sControl');
if (cName.indexOf('s_expanded')!=-1) {
boxArray[t].className=cName.replace(/s_expanded/,'s_shrinking');
control.className=control.className.replace(/sc_expanded/,'sc_shrinking');
} else if (cName.indexOf('s_expanding')!=-1) {
boxArray[t].className=cName.replace(/s_expanding/,'s_shrinking');
control.className=control.className.replace(/sc_expanding/,'sc_shrinking');
}
}
}
}
}
function toggleAccordion(sender,targetID) {
sender.blur();
target=document.getElementById(targetID);
control=sender.parentNode;
cName=target.className;
if (cName.indexOf('s_shrunk')!=-1) {
target.className=cName.replace(/s_shrunk/,'s_expanding');
control.className=control.className.replace(/sc_shrunk/,'sc_expanding');
checkRadio(target);
} else if (cName.indexOf('s_expanded')!=-1) {
target.className=cName.replace(/s_expanded/,'s_shrinking');
control.className=control.className.replace(/sc_expanded/,'sc_shrinking');
} else if (cName.indexOf('s_shrinking')!=-1) {
target.className=cName.replace(/s_shrinking/,'s_expanding');
control.className=control.className.replace(/sc_shrinking/,'sc_expanding');
checkRadio(target);
} else if (cName.indexOf('s_expanding')!=-1) {
target.className=cName.replace(/s_expanding/,'s_shrinking');
control.className=control.className.replace(/sc_expanding/,'sc_shrinking');
}
if (boxTimerActive<=0) boxTimer();
}
function setupAccordions() {
var tList=document.getElementsByTagName('*');
for (t=0; t<tList.length; t++) {
if (tList[t].id.indexOf('_sControl')!=-1) {
targetID=tList[t].id.replace(/_sControl/,'');
target=document.getElementById(targetID);
boxArray[boxArray.length]=target;
tList[t].innerHTML='<a href="javascript:void(0);" onclick="toggleAccordion(this,\''+targetID+'\'); return false;">'+tList[t].innerHTML+'<span></span></a>';
if ((target.className.indexOf('s_shrinking')!=-1) || (tList[t].className.indexOf('s_shrunk')!=-1)) {
target.style.height='0px';
target.className=target.className.replace(/s_shrinking/g,'s_shrunk');
state='sc_shrunk';
} else state='sc_expanded';
tList[t].className+=' s_control '+state;
}
}
}
THIS IS HTML
for the HTML codeing Just look at the Notepad cant seem to get the html coding to stick on here
Last edited by burnsyy; 05-26-2009 at 10:28 AM..
|
|
|
|
05-27-2009, 05:51 AM
|
Re: need help with javascript Hide and Show Codeing
|
Posts: 14
Location: UK,England,Essex
|
am sure sum1 knows this answer
|
|
|
|
05-27-2009, 09:17 AM
|
Re: need help with javascript Hide and Show Codeing
|
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
Let me give you a really simple example of how this could work:
HTML Code:
<head>
<style type="text/css">
#hidden-text {
display: none;
}
</style>
<script type="text/javascript">
window.onload=function() {
document.getElementById("show-text").onclick = function() {
document.getElementById("hidden-text").style.display = "block";
}
}
</script>
</head>
<body>
<div id="hidden-text">A bunch of text</div>
<a id="show-text">Click to show text</a>
|
|
|
|
05-27-2009, 10:42 AM
|
Re: need help with javascript Hide and Show Codeing
|
Posts: 14
Location: UK,England,Essex
|
Quote:
Originally Posted by wayfarer07
Let me give you a really simple example of how this could work:
HTML Code:
<head>
<style type="text/css">
#hidden-text {
display: none;
}
</style>
<script type="text/javascript">
window.onload=function() {
document.getElementById("show-text").onclick = function() {
document.getElementById("hidden-text").style.display = "block";
}
}
</script>
</head>
<body>
<div id="hidden-text">A bunch of text</div>
<a id="show-text">Click to show text</a>
|
thxs mate that isnt quite wot i need i need it to minimize on click and be smooth on opening and minimize like my codeing all i need is the key code to make my codeing on load for all that txt to be minimize insted of open
|
|
|
|
05-28-2009, 12:01 PM
|
Re: need help with javascript Hide and Show Codeing
|
Posts: 14
Location: UK,England,Essex
|
ISSUE SOLVED ty for trying to help
|
|
|
|
|
« Reply to need help with javascript Hide and Show Codeing
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|