Sau đây chúng tôi xin giới thiệu với bạn đọc bản hướng dẫn cắt dán khung chọn ảnh mời bạn đọc tham khảo
Đầu tiên bạn hãy chèn đoạn script sau vào trang của bạn
<script language="javascript">
<!--
function linkrotate(which){
var mylinks=new Array()
//them vao bao nhieu link ban muon (vi du:mylinks[3]=...)
mylinks[0]="http://www.vnn.vn/i-today/"
mylinks[1]=""
mylinks[2]=""
window.location=mylinks[which]
}
function showimage()
{
if (!document.images)
return
document.images.pictures.src=
document.mygallery.picture.options[document.mygallery.picture.selectedIndex].value
}
//-->
</script>
Trước khi tiếp tục bạn hãy thay đổi
mylinks[0]="http://www.abcnews.com" mylinks[1]="http://www.cnn.com" "
trong hàm “linkrotate()” cho phù hợp với URL của các hình ảnh trong hộp drop down.
Sau đó chèn đoạn mã sau vào phần <body> trong trang của mình:
<table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="100%"><form name="mygallery"><p><select name="picture" size="1" onChange="showimage()"> <option selected value="me.gif">Picture of me</option> <option value="myaunt.gif">Picture of my aunt</option> <option value="brother.gif">Picture of my brother</option> </select></p> < script language="javascript"> document.mygallery.picture.selectedIndex=0; </script> </form> </td> </tr> <tr> <td width="100%"><p align="center"><a href="javascript:linkrotate(document.mygallery.picture.selectedIndex)" onMouseover="window.status='';return true"><img src="me.gif" name="pictures" width="99" height="100" border=0></a></td> </tr> </table>
Phần chữ màu đỏ là phần mà bạn phải thay đổi các ảnh của mình trong hộp drop down cho phù hợp với đường dẫn file ảnh đó và thay đổi đoạn text giới thiệu từng ảnh của bạn trong tag <option>
Phần chữ màu da cam là phần cho phép bạn tùy ý chọn ảnh nào được load đầu tiên
Sưu tầm
Bạn đang muốn nâng cao kỹ năng lập trình của mình ?
|












