Просмотр сообщений

В этом разделе можно просмотреть все сообщения, сделанные этим пользователем.


Сообщения - CL2004

Страницы: [1] 2
1
Цитировать

function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}


поменял на :[/b/]
Цитировать

function contractcontent(omit){
var inc=0
switch (omit)
{
case "sc1":
sc2.style.display="none"
sc3.style.display="none"
break
case "sc2":
sc3.style.display="none"
break
case "sc3":
sc1.style.display="none"
sc2.style.display="none"
break
}
}

2
В исходном скрипте я поменял одну функцию и меню перестало работать под оперой и мозиллой. Вот весь файл:
var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="yes" //Collapse previously open content when opening present? (yes/no)
if (document.getElementById){
document.write(\'\')
}
function getElementbyClass(classname){
ccollect=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; iif (alltags.className==classname)
ccollect[inc++]=alltags
}
}
function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}
function expandcontent(cid){
if (typeof ccollect!="undefined"){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
}
}
function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; idocument.getElementById(selectedComponents).style.display="block"
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}
function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}
document.cookie=window.location.pathname+"="+selectedItem
}
function do_onload(){
getElementbyClass("switchcontent")
if (enablepersist=="on" && typeof ccollect!="undefined")
revivecontent()
}
if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload
if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate



Меняю функцию contractcontent на
function contractcontent(omit){
var inc=0
switch (omit)
   {
      case "sc1":
         sc2.style.display="none"
         sc3.style.display="none"
         break
      case "sc2":
         sc3.style.display="none"
         break
      case "sc3":
         sc1.style.display="none"
         sc2.style.display="none"         
         break   
   }
}
Мне нужны в выпадающем меню еще меню которые содеражат подменю
В принципе синтаксис С++, но почему тогда стало работать только под IE не пойму.

Помогите разобраться










Меню 1
   

      1.1
         

            1.1.1

            1.1.2

            1.1.3
         

      1.2
      1.3
   

Меню2
   
               
      2.1
      2.2
   



3
PHP / Как улучшить загрузку сайта
« : 27 Декабря 2004, 18:21:30 »
Цитировать
exec("convert -resize 800x600 $pic");

Не каждый хостер разрешает использовать функцию exec

Цитировать
Даже при использовании GD размер твоего скрипта можно сократитьна порядок.

Как? Подскажи

4
PHP / Как улучшить загрузку сайта
« : 27 Декабря 2004, 10:22:56 »
Цитировать
exec("convert -resize 800x600 $pic");

Привожу весь свой скрипт:

<?
	
$GD1_ENABLED false;
	
$GD2_ENABLED true;

	
header("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT");
	
header("Cache-Control: no-cache, must-revalidate");           // HTTP/1.1
  
	
header("Pragma: no-cache");

	
// $QUERY_STRING =
	
//  f(3c9b5fa6bc0fa)  img_file
	
//  s
	
	
	
	
	
	
	
	
	
save
	
//  w(123|15%)        width of output
	
//  h(123|10%)        height of output
	
//  x(123)            max width of output
	
//  y(123)            max height of output
	
//  t(jpg|png)        type of output
	
//  q(100)            quality of jpeg

	
// find tags
	
preg_match_all("/\\+*(([a-z])\\(([^\\)]+)\\))\\+*/"$QUERY_STRING$matches,
PREG_SET_ORDER);

	
// empty array and set regular expressions for the check
	
$tags = array();
	
$check = array(
	
	
\
'f\' => \'[^)+]+\',
	
	
\'s\' => \'[^)+]+\',
	
	
\'w\' => \'[0-9]+%?\',
	
	
\'h\' => \'[0-9]+%?\',
	
	
\'x\' => \'[0-9]+\',
	
	
\'y\' => \'[0-9]+\',
	
	
\'t\' => \'jpg|png\',
	
	
\'q\' => \'1?[0-9]{1,2}\' );

	
// check tags and save correct values in array
	
for ($i=0; $i<count($matches); $i++) {
  
	
if (isset($check[$matches[$i][2]])) {
    
	
if (preg_match(\'/^(\'.$check[$matches[$i][2]].\')$/\',
      
	
$matches[$i][3])) {
        $tags[$matches[$i][2]] = $matches[$i][3];
      }
    }
	
}

	
$filename = $tags[\'f\'];
	
if (!isset($filename)) notfound(); // check that filename is given
	
if (!file_exists($filename)) notfound(); // check if file exists
	
$imginfo = getimagesize($filename); // retrieve file info

	
// Load image
	
switch ($imginfo[2]) {
    case 2: // JPG
      $img_in = ImageCreateFromJPEG($filename) or notfound();
      if (!isset($tags["t"])) $tags["t"] = "jpg";
      break;
    case 3: // PNG
      $img_in = ImageCreateFromPNG($filename) or notfound();
      if (!isset($tags["t"])) $tags["t"] = "png";
      break;
    default:
      notfound();
	
}

	
// check for maximum width and height
	
if (isset($tags["x"])) {
    if ($tags["x"] < ImageSX($img_in)) {
      $tags["w"] = $tags["x"];
    }
	
}
	
if (isset($tags["y"])) {
    if ($tags["y"] < ImageSY($img_in)) {
      $tags["h"] = $tags["y"];
    }
	
}

	
// check for need to resize
	
if (isset($tags[\'h\']) || isset($tags[\'w\'])) {
    // convert relative to absolute
    if (isset($tags[\'w\'])) {
      if (strstr($tags[\'w\'], \'%\')) {
        $tags[\'w\'] = (intval(substr($tags[\'w\'], 0, -1)) / 100) * $imginfo[0];
      }
    }
    if (isset($tags[\'h\'])) {
      if (strstr($tags[\'h\'], \'%\')) {
      
	
$tags[\'h\'] = (intval(substr($tags[\'h\'], 0, -1)) / 100) * $imginfo[1];
      }
    }

    // resize
    if (isset($tags[\'w\']) && isset($tags[\'h\'])) {
      $out_w = $tags[\'w\'];
      $out_h = $tags[\'h\'];
    } elseif (isset($tags[\'w\']) && !isset($tags[\'h\'])) {
      $out_w = $tags[\'w\'];
      $out_h = $imginfo[1] * ($tags[\'w\'] / $imginfo[0]);
    } elseif (!isset($tags[\'w\']) && isset($tags[\'h\'])) {
      $out_w = $imginfo[0] * ($tags[\'h\'] / $imginfo[1]);
      $out_h = $tags[\'h\'];
    } else {
      $out_w = $tags[\'w\'];
      $out_h = $tags[\'h\'];
    }

    // New image in $img_out
	
	
if ($GD1_ENABLED) {
	
	
	
// Utilisation de GD version 1.6+
    
	
$img_out = ImageCreate($out_w, $out_h);
    
	
ImageCopyResized($img_out, $img_in, 0, 0, 0, 0, ImageSX($img_out),
ImageSY($img_out), ImageSX($img_in), ImageSY($img_in));
	
	
} else if ($GD2_ENABLED) {
	
	
	
// Utilisation de GD version 2.0
    
	
$img_out = ImageCreateTrueColor($out_w, $out_h);
    
	
ImageCopyResampled($img_out, $img_in, 0, 0, 0, 0, ImageSX($img_out),
ImageSY($img_out), ImageSX($img_in), ImageSY($img_in));
	
	
} else {
	
	
	
$img_out = $img_in;
	
	
}
	
} else {
    // no resize needed
    $img_out = $img_in;
	
}

	
// check for a given jpeg-quality, otherwise set to default
	
if (!isset($tags[\'q\'])) {
    $tags[\'q\'] = 75;
	
}

	
// returning the image
	
switch ($tags[\'t\']) {
    case \'jpg\':
	
	
	
if (!isset($tags[\'s\'])) {
	
	
	
	
header(\'Content-type: image/jpeg\');
	
	
	
	
ImageJPEG($img_out, \'\', $tags["q"]);
	
	
	
} else {
      
	
ImageJPEG($img_out, urldecode($tags[\'s\']), $tags["q"]);
	
	
	
	
header(\'Location: \' . FUNCTION_getRelativePath(urldecode($tags[\'s\'])));
	
	
	
}
	
	
	
ImageDestroy($img_out);
      exit;
    case \'png\':
      if (!isset($tags[\'s\'])) {
	
	
	
	
header(\'Content-type: image/png\');
      
	
ImagePNG($img_out);
	
	
	
} else {
	
	
	
	
ImagePNG($img_out, urldecode($tags[\'s\']));
	
	
	
	
header(\'Location: \' . FUNCTION_getRelativePath(urldecode($tags[\'s\'])));
	
	
	
}
	
	
	
ImageDestroy($img_out);
      exit;
   default:
      notfound();
	
}

	
function notfound() {
	
	
	
header(\'Location: error.gif\');
	
	
	
exit;
	
}
?>

Получается вместо такого  скрипта можно обойтись всего одной строчкой?

5
PHP / Как улучшить загрузку сайта
« : 25 Декабря 2004, 13:31:49 »
Да у меня 10-15 фотографий и каждая "ресайзица", а если будет грузится "чистая" фотография, то несомненно загрузка будет быстрее.
RomikChef, ты ж опытный, на сколько процентов возрастет загрузка страници, как думаешь?

6
PHP / Как улучшить загрузку сайта
« : 25 Декабря 2004, 13:00:39 »
Здравствуйте!
Как можно ускорить загрузку сайта http://www.citylife.com.ua/?
Для ресайза картинок я там использую скрипт - может из-за этого он так плохо грузится?

7
PHP / addslashes проблемы
« : 22 Ноября 2004, 12:50:17 »
$text=addslashes(nl2br($text));

Если пишу в тексте обратный слеш \\ то в базу не вставляет - почему? выдает ошибку скл запроса
И еще magic_quotes=on

8
Обсуждение сайтов / Зацените сайт
« : 19 Ноября 2004, 11:18:47 »
Да есть такой недостаток, но такова уж концепция журнала. Можна сказать это его фишка - красивые, качественные и ексклюзивные фото.
В принципе тяжелая только стартовая страница, остальные будут где-то раза в 2 меньше(в районе 100Кб)

9
Обсуждение сайтов / Зацените сайт
« : 19 Ноября 2004, 11:03:47 »
Здравствуйте!
Прошу высказать мнение по сайту - http://citylife.com.ua
(мысли по дизайну и програмированию)

10
PHP / Отправка сообщений на асю
« : 15 Ноября 2004, 13:50:44 »
Можна ли как-то на пхп отправить сообщение на icq и если да то как. Спасибо

11
Всё о Html / Работа с фреймами - проблемы
« : 09 Ноября 2004, 18:46:20 »
Цитировать
2. scrolling=no в свойствах фрейма или как-то так

Цитировать
3. norezie в свойствах фрейма или как-то так

Так я пишу :
onclick="window.open(\'sc.php\', \'_111_\', \'width=600, height=650, toolbar=no,scrollbars=no,resizable=no\');"
Ни фига не помогает.

Цитировать
1. width=Math.round(screen.width/2-ширина_окна/2)
height - аналогично

Что с этим делать можешь подробнее обьяснить?

12
TEXT>


Нужно сделать так чтобы в зависимости от браузера менялось значение clas1.
Например если интернет експлорер то clas1, а если опера или мозила то clas2
Я пЫтался сам написать но что-то не выходит у меня, поправте пожалуйста:


13
Всё о Html / Работа с фреймами - проблемы
« : 08 Ноября 2004, 12:29:37 »
На ссылку я повесил такой код:
 onclick="window.open(\'sc.php\', \'_111_\', \'width=600, height=650, toolbar=no,scrollbars=no,resizable=no\');"

sc.php




 


У меня такие вопросы:

1. Как сделать чтобы это окно, которое открывается по ссылке появлялось строго по средине экрана

2. Почему если информации очень много(больше чем на height=650)  то появляется горизонтальная полоса прокрутки.

3. Если мышкой выделить границу фреймов то можна двигать фреймы. Тоесть верхний который на 20 процентов можно растянуть на весь экран

14
PHP / strtoupper - проблемы
« : 29 Октября 2004, 14:47:57 »
Что-то прочитал и ни фигша не понял. Можешь с примером обьяснить по setlocale.
Или может быть обойтись функцией типа этого:
function  up($str)
{
for($i=0; $i<=strlen($str); $i++)
  {
    switch $str[$i]
   {
     case "a":
       $str[$i]=\'A\';
       break;      
     case "b":
       $str[$i]=\'B\';
       break;
     case "E":
       $str[$i]=\'E\';
       break;
............
   }
  }   
return($str);   
}
Или можна еще как-то?

15
PHP / strtoupper - проблемы
« : 29 Октября 2004, 14:04:51 »
В цикле я из базы выбираю записи($rub_m)  и вывожу таким образом:


В локальной версии все нормально работает, а в интернете пишет маленькими буквами. Почему?

Страницы: [1] 2