Minecraft 皮肤预览问题

发布于 2024-12-02 07:11:16 字数 543 浏览 2 评论 0原文

根据另一个问题,您可以使用以下代码查看您的皮肤:

<applet code="net.minecraft.skintest.ModelPreviewApplet"
        archive="http://www.minecraft.net/skin/skintest.jar" codebase="."
        width="320" height="320">
    <param name="name" value="535" />
</applet>

Which Works!

但是有谁知道我如何制作一个文本框和一个按钮,将书面文本放入 value="535" 标记中(用文本框输入替换“535”)?

链接到另一个问题:是否有可嵌入网络的皮肤预览应用程序?

According to another question, you can view your skin with this code:

<applet code="net.minecraft.skintest.ModelPreviewApplet"
        archive="http://www.minecraft.net/skin/skintest.jar" codebase="."
        width="320" height="320">
    <param name="name" value="535" />
</applet>

Which works!

But does anyone knows how i can make a textbox and a button which puts the written text in the value="535" tag (replaces "535" with the text box input)?

Link to the other question: Is there a web-embeddable skin preview application?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ま昔日黯然 2024-12-09 07:11:16

您可以在运行时将小程序写入 DOM,如下所示:

<div id="wrapper"></div>
<input type="text" value="" onchange="writeApp(this.value)">
<input type="button" value="go">

<script type="text/javascript">
function writeApp(pVal) {
     document.getElementById('wrapper').innerHTML = '<applet  code="net.minecraft.skintest.ModelPreviewApplet"  archive="http://www.minecraft.net/skin/skintest.jar" codebase="."  width="320" height="320"><param name="name" value="'+pVal+'" /></applet>'   
}   
</script>

奇怪的是,小程序似乎不喜欢“525”以外的值

You can write your applet into the DOM at run-time like this:

<div id="wrapper"></div>
<input type="text" value="" onchange="writeApp(this.value)">
<input type="button" value="go">

<script type="text/javascript">
function writeApp(pVal) {
     document.getElementById('wrapper').innerHTML = '<applet  code="net.minecraft.skintest.ModelPreviewApplet"  archive="http://www.minecraft.net/skin/skintest.jar" codebase="."  width="320" height="320"><param name="name" value="'+pVal+'" /></applet>'   
}   
</script>

Strangely enough, the applet doen't seem to like values other than "525"

笑咖 2024-12-09 07:11:16

这应该很容易,但我认为它不会做你想做的事。

我假设您想要一个带有纹理预览的预览窗口,并允许用户输入新的纹理 ID,按下按钮,然后立即查看预览。

在页面加载后简单地更改 param 的值并不能实现这一点。

当按钮被按下时,您需要删除小程序并使用新的参数值重新创建它,以使更改生效。

这是您要求的代码:

<applet
        code="net.minecraft.skintest.ModelPreviewApplet"
        archive="http://www.minecraft.net/skin/skintest.jar" codebase="."
        width="320"
        height="320">
    <param name="name" id="previewName" value="535" />
</applet>

<input type="text" id="newValue" />

<script>
document.getElementById('newValue').onblur = function(event) {
    // grab value
    var iVal = parseInt(this.value);
    if(!iVal && iVal !== 0) return;

    // update param
    document.getElementById('previewName').value = iVal;
    return true;
};
</script>

如果您尝试这样做,但它没有实现您想要的效果,请告诉我,我可以编写可以实现此目的的代码。

That should be easy, but I don't think it will do what you want it to do.

I'm assuming you want to have a preview window with the texture preview, and allow users to type in new texture IDs, push the button, and see the preview right away.

Simply changing the value of the param after the page has loaded won't accomplish that.

When the button gets pushed, you'll need to remove the applet and re-create it, with the new param value in order for the changes to take effect.

Here's the code you asked for:

<applet
        code="net.minecraft.skintest.ModelPreviewApplet"
        archive="http://www.minecraft.net/skin/skintest.jar" codebase="."
        width="320"
        height="320">
    <param name="name" id="previewName" value="535" />
</applet>

<input type="text" id="newValue" />

<script>
document.getElementById('newValue').onblur = function(event) {
    // grab value
    var iVal = parseInt(this.value);
    if(!iVal && iVal !== 0) return;

    // update param
    document.getElementById('previewName').value = iVal;
    return true;
};
</script>

If you try that and it doesn't accomplish what you wanted, let me know and I can write the code that will do it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文