java网页设计代码 java语言网页设计

网页设计的javacsript的图片切换代码, 谁能帮我写个例子 鼠标指向1234的那种, 不需要任何特效无标题文档 ul{ list-style:none;} li{ display:inline; float:left; margin-left:15px; display:none;} img{border:5px solid #000; width:100px; height:100px;} .pagediv{ clear:both; margin:15px; display:block;} .pagediv a{border:1px solid #c9c9c9; margin-left:5px;}function changepic(num,n){ //num当前要显示的图片n 图片总数for(i=1;ivar menu=document.getElementById("pic"+i);menu.style.display=i==num?"block":"none";}}
" /
" /1234
网页设计中怎样设置图片自动切换?要给个看得懂的代码,只要能够用的HTML. Java 都可以,还要轮播图自动切换吗?
script language =javascript
var curIndex=0;
//时间间隔 单位毫秒
var timeInterval=1000;
var arr=new Array();
arr[0]="1.jpg";
arr[1]="2.jpg";
arr[2]="3.jpg";
arr[3]="4.jpg";
arr[4]="5.jpg";
arr[5]="6.jpg";
arr[6]="7.jpg";
setInterval(changeImg,timeInterval);
function changeImg()
{
var obj=document.getElementById("obj");
if (curIndex==arr.length-1)
{
curIndex=0;
}
else
{
curIndex+=1;
}
obj.src=https://www.04ip.com/post/arr[curIndex];
}
/script
img id=obj src ="https://www.04ip.com/post/1.jpg" border =0 /
这样能看懂吗?
自己设置每张图片切换的时间间隔,自己设置每张图片的路径,绝对、相对路径都可以 。
设计一个JAVA程序,下载由URL指定的网页的源代码 , 找出其中所有的超链接 。import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class HttpViewer extends JFrame {
private JTextField urlInput;
private JTextArea viewArea;
public static void main(String[] args) {
new HttpViewer();
}
public HttpViewer() {
this.setTitle("Http Viewer");
this.setSize(800, 600);
this.setResizable(false);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
initPanel();
initAction();
this.setVisible(true);
}
// 这个方法用来设置窗口布局
private void initPanel() {
JPanel northPanel = new JPanel();
JLabel urlInputLabel = new JLabel("URL:");
urlInput = new JTextField(60);
northPanel.add(urlInputLabel);
northPanel.add(urlInput);
this.add(northPanel, BorderLayout.NORTH);
JPanel centerPanel = new JPanel();
viewArea = new JTextArea(27, 60);
centerPanel.add(new JScrollPane(viewArea));
this.add(centerPanel);
}
// 这个方法用来设置事件
private void initAction() {
urlInput.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String text = urlInput.getText();
if (text == null || text.length() == 0) {
viewArea.setText("您没有输入URL");
return;
}
try {
URL url = new URL(text);
String context = getContent(url);
if (context != null) {
searchFromText(context);
}
} catch (MalformedURLException e1) {
viewArea.setText("您输入java网页设计代码的URL不合法:" + text);
}
}
});
}
private String getContent(URL url) {
StringBuffer builder = new StringBuffer();

推荐阅读