我有一个子 html (模板)products.html,我index.html使用 JavaScript/jquery 函数 .load() 将其包含在我的页面中
现在的问题是,如果你输入products.html的url,就可以直接访问它,而且它给出的页面非常难看,所以我尝试使用JS函数将任何试图访问它的人重定向到index.html windows.location。这种方法的问题是,当我的模板加载到我的主页中时,js 脚本会触发,并导致页面刷新。那么还有其他方法可以解决这个问题吗?
我在 Oracle 文档中找到了一个关于 SplashScreen 的示例。问题是在这个例子中,这里使用的图像的链接在命令行中作为参数传递。我正在尝试更改代码,以便将链接写在里面,我不需要使用命令行。
methodesetImageURL(URL imageURL)应该能够为我完成这项工作,但它不接受我的参数(参数)。
我读过 URL 类,似乎它需要协议!像http和ftp这样的协议?如果是这样,我的 url 应该如何用于计算机中的文件?当我尝试从我的计算机(例如:)放置链接时,"C:\plash.gif"它说illege excape character
我什至尝试对图像使用 http 链接,但它在 URL 行中给了我这个错误:
non-static method setImageURL(URL) cannot be referenced from a static context
Run Code Online (Sandbox Code Playgroud)
这是代码:
package misc;
import java.awt.*;
import java.awt.event.*;
import java.net.URL;
public class SplashDemo extends Frame implements ActionListener {
static void renderSplashFrame(Graphics2D g, int frame) {
final String[] comps = {"foo", "bar", "baz"};
g.setComposite(AlphaComposite.Clear);
g.fillRect(120,140,200,40);
g.setPaintMode();
g.setColor(Color.BLACK);
g.drawString("Loading "+comps[(frame/5)%3]+"...", 120, 150);
}
public SplashDemo() {
super("SplashScreen demo");
setSize(300, …Run Code Online (Sandbox Code Playgroud) 我正在尝试为复杂类型编写一些函数,但我无法使其工作.
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
typedef struct{
double a; /* Real*/
double b; /* Imaginary*/
}Complex;
Complex Nmbr1,Nmbr2;
int main()
{
Complex NmbrMulti;
printf("Type the value of the real part of the first number\n");
scanf("%d",&Nmbr1.a);
printf("\nType the value of the Imaginary part of the first number\n");
scanf("%d",&Nmbr1.b);
printf("\nType the value of the real part of the second number\n");
scanf("%d",&Nmbr2.a);
printf("\nType the value of the Imaginary part of the second number\n");
scanf("%d",&Nmbr2.b);
NmbrMulti.a = Nmbr1.a * Nmbr2.a - Nmbr1.b * Nmbr2.b ; …Run Code Online (Sandbox Code Playgroud)