Jump to content

2 dicas precisam-se: check all, show more


pedrotuga

Recommended Posts

Para marcar/desmarcar todas :

Javascript

<SCRIPT LANGUAGE="JavaScript">
<!-- 	
// <input type=button name="Marcar"   value="Marcar todas"
//onClick="checkAll(document.myform.list)">
// <input type=button name="Desmarcar" value="Desmarcar todas"
//onClick="uncheckAll(document.myform.list)">
// -->

<!-- Begin
function checkAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = false ;
}
//  End -->
</script>

Html

<form name="myform" action="checkboxes.asp" method="post">
<b>Shareminer.com (beta)</b><br>
<input type="checkbox" name="list" value="1">Rapidshare<br>
<input type="checkbox" name="list" value="2">Megaupload<br>
<input type="checkbox" name="list" value="3">Sende me files<br>
<input type="checkbox" name="list" value="4">Filefront<br>
<input type="checkbox" name="list" value="5">Zshare<br>

<input type="button" name="Marcarl" value="Marcar todosl"
onClick="checkAll(document.myform.list)">
<input type="button" name="Desmarcarl" value="Desmarcar todos"
onClick="uncheckAll(document.myform.list)">
<br>
</form>



Link to comment
Share on other sites

mmmm parece facil... vou implementar isto um dia qq desta semana se tiver tempo.

Já agora... no meu código, como o php faz um push automático para o topo do array usei o seguinte código:

		<input type="checkbox" name="siteid[]" value="4">mooload.com</td><td><input type="checkbox" name="siteid[]" value="5">rapidsharing.com<br>
		<input type="checkbox" name="siteid[]" value="6">megashares.com<br>
		<input type="checkbox" name="siteid[]" value="7">box.net<br>

como é que devo por no código

assim:

<input type="button" name="Marcarl" value="Marcar todosl"
onClick="checkAll(document.myform.siteid)">

ou assim

<input type="button" name="Marcarl" value="Marcar todosl"
onClick="checkAll(document.myform.siteid[])">
Link to comment
Share on other sites

<script language="javascript">
function showMore(varA1, varB1){
var123 = ('varXYZ' + (varA1));
varABC = ('varP' + (varA1));
if( document.getElementById ) {
if( document.getElementById(var123).style.display ) {
if( varB1 != 0 ) {
document.getElementById(var123).style.display = "block";
document.getElementById(varABC).style.display = "none";
} else { document.getElementById(var123).style.display = "none";
document.getElementById(varABC).style.display = "block"; }
} else { location.href = varB1;
return true; }
} else { location.href = varB1;
return true; }
}

function showMoreComments(varA12, varB12){
var1232 = ('varXYZ2' + (varA12));
varABC2 = ('varP2' + (varA12));
if( document.getElementById ) {
if( document.getElementById(var1232).style.display ) {
if( varB12 != 0 ) {
document.getElementById(var1232).style.display = "block";
document.getElementById(varABC2).style.display = "none";
} else { document.getElementById(var1232).style.display = "none";
document.getElementById(varABC2).style.display = "block"; }
} else { location.href = varB12;
return true; }
} else { location.href = varB12;
return true; }
}
</script>

Para mostrar o resto do texto :

<MTEntryIfExtended>
<span id="varP<$MTEntryID$>"><a href="<$MTEntryLink$>#<$MTEntryID pad="1"$>" onclick="showMore(<$MTEntryID$>,'<$MTEntryLink$>#<$MTEntryID pad="1"$>');return false;"><p>read more »</p></a><br /></span><div id="varXYZ<$MTEntryID$>" style="display: none"><p><$MTEntryMore$></p><a href="#<$MTEntryID pad="1"$>" onclick="showMore(<$MTEntryID$>,0);return
true;"><p>« hide more</p></a></div>
</MTEntryIfExtended>

Para os comentários:

<MTEntryIfAllowComments>
<span id="varP2<$MTEntryID$>" class="extended"><a href="<$MTEntryLink$>#<$MTEntryID pad="1"$>" onclick="showMoreComments(<$MTEntryID$>,'<$MTEntryLink$>#<$MTEntryID pad="1"$>');return false;"><p>show comments right here »</p></a><br /></span><div id="varXYZ2<$MTEntryID$>" style="display: none">
<MTComments>
<$MTCommentBody$>
<p>Posted by <$MTCommentAuthorLink$> at <$MTCommentDate$></p><br /><br />
</MTComments>
<a href="#<$MTEntryID pad="1"$>" onclick="showMoreComments(<$MTEntryID$>,0);return
true;"><p>« hide comments</p></a></div>
</MTEntryIfAllowComments>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.