How to set max length for file names ?
Thanks.
XFileSharing Pro - How to set max length for file names ?
copy the javascript code that checks for banned filetypes and use .length
http://www.tizag.com/javascriptT/javasc ... length.php
http://www.tizag.com/javascriptT/javasc ... length.php
-
- Posts: 27
- Joined: Oct 05, 2010 12:53 pm
Hi,
If you need to display a limited number of characters it can be done using Jquery
If you need to display a limited number of characters it can be done using Jquery
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>untitled</title>
<style type="text/css" media="screen">
.hide{
display: none;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
$(function(){
var $elem = $('p'); // The element or elements with the text to hide
var $limit = 10; // The number of characters to show
var $str = $elem.html(); // Getting the text
var $strtemp = $str.substr(0,$limit); // Get the visible part of the string
$str = $strtemp + '<span class="hide">' + $str.substr($limit,$str.length) + '</span>'; // Recompose the string with the span tag wrapped around the hidden part of it
$elem.html($str); // Write the string to the DOM
})
</script>
</head>
<body>
<p>Some random line........</p>
</body>
</html>
hi krazyloads thanks for helping me on this matekrazyloads wrote:Hi,
If you need to display a limited number of characters it can be done using Jquery
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>untitled</title> <style type="text/css" media="screen"> .hide{ display: none; } </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" charset="utf-8"> $(function(){ var $elem = $('p'); // The element or elements with the text to hide var $limit = 10; // The number of characters to show var $str = $elem.html(); // Getting the text var $strtemp = $str.substr(0,$limit); // Get the visible part of the string $str = $strtemp + '<span class="hide">' + $str.substr($limit,$str.length) + '</span>'; // Recompose the string with the span tag wrapped around the hidden part of it $elem.html($str); // Write the string to the DOM }) </script> </head> <body> <p>Some random line........</p> </body> </html>
I have tried to put this code into download0.html but nothing happens :
Im sorry i'm a newbie at this, Could you please explain me step by step what to do or could I maybe have your email so I could contact you on messenger, That would be way easier. Thanks !<style type="text/css" media="screen">
.hide{
display: none;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jq ... "></script>
<script type="text/javascript" charset="utf-8">
$(function(){
var $elem = $('p'); // The element or elements with the text to hide
var $limit = 10; // The number of characters to show
var $str = $elem.html(); // Getting the text
var $strtemp = $str.substr(0,$limit); // Get the visible part of the string
$str = $strtemp + '<span class="hide">' + $str.substr($limit,$str.length) + '</span>'; // Recompose the string with the span tag wrapped around the hidden part of it
$elem.html($str); // Write the string to the DOM
})
</script>