在第1页上,有一个链接可以将您带到第2页的某个点
<a href="page2.html#position">MY TEXT HERE</a>
这将使用以下代码直接转到第2页的锚点(位置)
<a name="position"> MORE TEXT HERE</a>
Run Code Online (Sandbox Code Playgroud)
现在,我的问题是当#position在URL中时如何更改文本和背景颜色?
例如:www.domainname.com/page2.html#position
这是我使用的CSS,但不起作用:
#position {
color:#ff0000;
background-color:#f5f36e;
}
Run Code Online (Sandbox Code Playgroud)
这是一个例子http://jsfiddle.net/jvtcj/2/
先感谢您!
如何在不更改数组顺序的情况下找到int数组中的最小值?
代码段:
int[] tenIntArray = new int [10];
int i, userIn;
Scanner KyBdIn = new Scanner(System.in);
System.out.println("Please enter 10 integer numbers ");
for(i = 0; i < tenIntArray.length; i++){
System.out.println("Please enter integer " + i);
userIn = KyBdIn.nextInt();
tenIntArray[i] = userIn;
}
Run Code Online (Sandbox Code Playgroud)
我不知道如何在tenIntArray中找到最小的数组值并显示位置
例如,数组成立 - [50, 8, 2, 3, 1, 9, 8, 7 ,54, 10]
输出应该说" The smallest value is 1 at position 5 in array"
我在以下代码中遇到了解密问题.我有一个加密的字符串发送到setData().我试图解密加密的字符串(数据).我一直得到的错误是
javax.crypto.IllegalBlockSizeException:解密时最后一个块不完整
byte[] data;
String key = "tkg96827pco74510";
byte[] encryptedOut;
String decryptedOut;
Key aesKey;
Cipher cipher;
public void setData(String dataIn){
this.data = dataIn.getBytes();
try {
aesKey = new SecretKeySpec(key.getBytes(), "AES");
cipher = Cipher.getInstance("AES");
}catch(Exception e){
System.out.println("SET DATA ERROR - " + e);
}
}
public void encrypt() {
try{
cipher.init(Cipher.ENCRYPT_MODE, aesKey);
encryptedOut = cipher.doFinal(data);
}catch(Exception e){
System.out.println(e);
}
}
public void decrypt(){
try {
cipher.init(Cipher.DECRYPT_MODE, aesKey);
decryptedOut = new String(cipher.doFinal(data));
}catch(Exception e){
System.out.println("Decrypt Error: " + e);
}
}
public …Run Code Online (Sandbox Code Playgroud)