導航:首頁 > 萬維百科 > 網站的js效果設計

網站的js效果設計

發布時間:2020-11-18 01:08:43

1、網頁設計軟體DW里,JS效果代碼怎麼增加到原有的網頁代碼內?

<script type="text/javascript" src="js文件地址"></script>這是外調js
<script type="text/javascript">
這是頁面內直接寫js
</script>

2、網頁設計里的js文件是什麼

有問題找百度,不要這么懶

先在網頁一般都會用javascript實現頁面的動態效果,甚至用Ajax(javascript+XML)實現非同步通信效果。

用到javascript代碼的頁面中,javascript代碼的存放位置總共有三種情況:
1. 在<script></script>標簽中間
2. 在各個標簽的< ... onClick="javacript代碼" /> 中
3. 外置的javascript代碼,就是以 .js 文件形式存在

3、關於網站整體JS架構(設計)的問題 前端設計師請進

有這么個講法?一般就是需要啥寫啥咯,根據設計稿做呀,哪裡要動了,就寫個滾動代碼,至於ajax,這個要跟後台程序員商榷,共同完成

4、網頁設計中常用的javascript腳本有哪些

$(「a[href=』#top』]」).click(function() {   

$(「html, body」).animate({ scrollTop: 0 }, 「slow」);   

return false;   

});  

復制以上代碼放在網頁的JavaScript標簽中,然後在底部添加一個id為「top」的鏈接就會自動返回到頂部了。

2、復製表單頂部標題到底部:

var $tfoot = $(『<tfoot></tfoot>』);   

$($(『thead』).clone(true, true).children().get().reverse()).each(function(){   

$tfoot.append($(this));   

});   

$tfoot.insertAfter(『table thead』);  

3、載入額外的內容:

$(「#content」).load(「somefile.html」, function(response, status, xhr) {   

// error handling   

if(status == 「error」) {   

$(「#content」).html(「An error occured: 「 + xhr.status + 」 「 + xhr.statusText);   

}   

});  

有時候需要為單獨的一個div層從外部載入一些額外的數據內容,下面這段短碼將會非常有用。

4、設置多列層等高:

var maxheight = 0;   

$(「div.col」).each(function(){   

if($(this).height() > maxheight) { maxheight = $(this).height(); }   

});   

$(「div.col」).height(maxheight);  

在一些布局設計中,有時候需要讓兩個div層高度相當,下面是採用js方法實現的原理(需要等高的div層設置class為」col」)。

5、定時刷新部分頁面的內容:

setInterval(function() {   

$(「#refresh」).load(location.href+」 #refresh>*」,「」);   

}, 10000); // milliseconds to wait  

如果在你的網頁上需要定時的刷新一些內容,例如微博消息或者實況轉播,為了不讓用戶繁瑣的刷新整個頁面,可以採用下面這段代碼來定時刷新部分頁面內容。

6、預載入圖像:

$.preloadImages = function() {   

for(var i = 0; i<arguments.length; i++) {   

$(「<img />」).attr(「src」, arguments[i]);   

}   

}   

$(document).ready(function() {   

$.preloadImages(「hoverimage1.jpg」,「hoverimage2.jpg」);   

});  

有些網站頁面打開圖像都未載入完畢,還要苦苦等待。下面這段代碼實現圖像都載入完畢後再打開整個網頁。

7、測試密碼強度:
這個比較給力,現在很多網站注冊的時候都加入了密碼強度測試功能,以下代碼也簡單提供了密碼強度測試功能。

HTML代碼部分:

<input type=「password」 name=「pass」 id=「pass」 />  

<span id=「passstrength」></span>  

JavaScript腳本代碼:

$(『#pass』).keyup(function(e) {   

var strongRegex = new RegExp(「^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*W).*$」, 「g」);   

var mediumRegex = new RegExp(「^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$」, 「g」);   

var enoughRegex = new RegExp(「(?=.{6,}).*」, 「g」);   

if (false == enoughRegex.test($(this).val())) {   

$(『#passstrength』).html(『More Characters』);   

} else if (strongRegex.test($(this).val())) {   

$(『#passstrength』).className = 『ok』;   

$(『#passstrength』).html(『Strong!』);   

} else if (mediumRegex.test($(this).val())) {   

$(『#passstrength』).className = 『alert』;   

$(『#passstrength』).html(『Medium!』);   

} else {   

$(『#passstrength』).className = 『error』;   

$(『#passstrength』).html(『Weak!』);   

}   

return true;   

});  

8、自適應縮放圖像:
有時候網站上傳的圖像需要填充整個指定區域,但是有時候圖像比例並不恰好合適,縮放後效果不好。一下代碼就實現了檢測圖像比例然後做適當的縮放功能。

$(window).bind(「load」, function() {   

// IMAGE RESIZE   

$(『#proct_cat_list img』).each(function() {   

var maxWidth = 120;   

var maxHeight = 120;   

var ratio = 0;   

var width = $(this).width();   

var height = $(this).height();   

if(width > maxWidth){   

ratio = maxWidth / width;   

$(this).css(「width」, maxWidth);   

$(this).css(「height」, height * ratio);   

height = height * ratio;   

}   

var width = $(this).width();   

var height = $(this).height();   

if(height > maxHeight){   

ratio = maxHeight / height;   

$(this).css(「height」, maxHeight);   

$(this).css(「width」, width * ratio);   

width = width * ratio;   

}   

});   

//$(「#contentpage img」).show();   

// IMAGE RESIZE   

});  

9、自動載入內容:
現在很多網站,特別是微博,都不需要翻頁的按鈕了,直接下拉後會自動載入內容。下面的腳本就是簡單實現了個這種效果。

var loading = false;   

$(window).scroll(function(){   

if((($(window).scrollTop()+$(window).height())+250)>=$(document).height()){   

if(loading == false){   

loading = true;   

$(『#loadingbar』).css(「display」,「block」);   

$.get(「load.php?start=」+$(『#loaded_max』).val(), function(loaded){   

$(『body』).append(loaded);   

$(『#loaded_max』).val(parseInt($(『#loaded_max』).val())+50);   

$(『#loadingbar』).css(「display」,「none」);   

loading = false;   

});   

}   

}   

});   

$(document).ready(function() {   

$(『#loaded_max』).val(50);   

});  

5、網頁裡面就一張室內設計圖片 怎麼在這個頁面加些動畫效果呢 。比如js效果 或者啥的

很多時候會反圖片當背景,上面加個透明適合的flash
也有用JS圖片特效,把多張圖片做個切換的效果

6、網頁設計中所有JS特效的加入 如何做得(軟體Dreamwear)

像下面這樣寫,包含在<head></head>標簽裡面,其中src="js/control.js",js就文件夾,control.js是js特效文件,這里因為control.js文件在js這個文件夾下,所以要進入該文件找到它。
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>網站名</title>
<link rel="stylesheet" href="styles/base-top.css" type="text/css" />
<link rel="stylesheet" href="styles/base-content.css" type="text/css" />
<link rel="stylesheet" href="styles/base-foot.css" type="text/css" />
<script src="js/jquery-1.4.2.js"></script>
<script language="javascript" src="js/control.js"> </script>
<script language="JavaScript" src="js/filter.js"> </script>
</head>

7、網頁設計里的js文件是什麼

有問題找百度,不要這么懶

先在網頁一般都會用javascript實現頁面的動態效果,甚至用Ajax(javascript+XML)實現非同步通信效果。

用到javascript代碼的頁面中,javascript代碼的存放位置總共有三種情況:
1. 在<script></script>標簽中間
2. 在各個標簽的< ... onClick="javacript代碼" /> 中
3. 外置的javascript代碼,就是以 .js 文件形式存在

8、html+css已經可以做出很不錯的網頁了,js在網頁設計是什麼用的?ajax?

只有js才能網頁真正的動起來 這是html+css做不到的

9、設計網站的時候,為什麼不用 CSS3 和JS 特效?

設計網站?這是用ps做出來的psd圖片,你是不是問錯了?把問題描述清楚一點,你這樣我不清楚你想問的重點是什麼。

與網站的js效果設計相關的知識