希望用户选择使用不同JS的游戏,但使用相同的HTML [英] Want user to choose game that uses different JS, but same HTML

查看:43
本文介绍了希望用户选择使用不同JS的游戏,但使用相同的HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定要使用哪些搜索字词来查找能够提供我所需内容的示例JavaScript。


我有一个拼字游戏,其中唯一的东西随着不同游戏而变化的是JavaScript的链接。我知道我可以创建一个包含1个HTML页面的页面,以及指向各种JS文件的链接,用户可以选择要播放的游戏,而不需要26个单独的HTML文件。但是,我不知道如何研究找到这样的代码,也不知道如何编程。


HTML页面

JS下拉菜单


通缉结果:抓取JS代码,HTML页面显示什么游戏需要可玩,但从JS页面访问答案。


我知道我必须使用一个数组,带有JS文件的链接,以及某种下拉菜单,但我不知道如何获取当前的HTML文件,显示游戏,但选择JS来玩游戏。 PS。我的JavaScript知识是脑损伤的极端新手。我才刚刚开始理解一些JS概念。提前致谢!


代码原样是:JavaScript

< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号

解决方案

忘记上面的代码,因为它甚至不接近我应该发布的内容。抱歉!

这是我到目前为止所得到的。我不知道如何让Arrays进行通信,然后让html代码使用所选的JS。


谢谢!

展开 < span class =codeDivider> | 选择 | Wrap | Line数字


我意识到,随着脑损伤的数量,我应该尝试更容易的事情,比如编织。但是,有人能告诉我哪些搜索条件可能对我有帮助吗?或者,有人能指出我错过的代码吗?谢谢! :D


我的问题是我无法弄清楚如何编写代码,告诉计算机如何处理JS选择。我确定我可以获得在窗口中发布JS的代码,但这不是我想要的。我所拥有的代码片段,为记忆创造了一个游戏领域。这不是很有用。我有完整的游戏代码,我只需要计算机使用游戏的JS文件和另一半游戏代码的HTML文件并结合2.我认为document.write不会做它,因为它只会打印任何东西,而不是做任何事情。

谢谢!


我的问题我仍然想要答案是:

1)使用什么搜索词找出如何将输入选择与html页面结合以获得选择放入html页面的js文件。我想更多地了解这一点,但我的搜索条件并不能完全给我写入资源。我得到的是如何制作下拉导航菜单。 :P


我确实提出了一个非常愚蠢,非常新手的解决方案。在JS中编写整个HTML页面,以便使用if else else语句进行所有可能的选择。在这种情况下,1 IF和11 else语句。因此,如果选择是1a.js,那么文档写入语句将是1a.js文件的javascript链接。


我仍​​然会使用下拉菜单进行选择,但我不确定下拉菜单和if else语句之间是否需要一行代码。


2)我的另一个问题:


鉴于上面的新手解决方案,适当的搜索条件是什么?这会给我正确的文章阅读,这将有助于我的新手类型解决方案?

谢谢!


签名困惑谁正在研究如何用JS完全编写HTML页面,这是我试图避免的解决方案!


是的,我正在和自己沟通。没问题,我确实设法将解决方案与我的其他问题联系起来,因此不需要回复。 :D人们很忙,我很好。


Naysayers:

信不信由你,我会在发布问题之前等待相当长的时间。事实上,我不会发布很多JS问题只是因为我刚刚开始与语言联系。再给它一年。我有很多问题,我觉得应该等到我已经完成了至少我应该搜索的方向。

非常感谢! :d

I''m not sure what search terms to put in to find a sample JavaScript that will give me what I need.

I have a Scrambled word game whereby the ONLY thing that changes with the different games is the link to the JavaScript. I know that I can make a page that has 1 HTML page, and a link to the various JS files, whereby the user can choose which game that want to play, without having 26 separate HTML files. However, I do not know how to research to find a code like this, nor can I figure out how to program this.

HTML page
JS drop down Menu

Wanted Result: JS code grabbed, with HTML page showing whats needed for game to be playable, but access the answers from the JS page.

I know that I have to use an Array, with links to the JS files, and some sort of drop down menu, but I don''t know how to get the current HTML file, to show the game but with the JS chosen for playing the game. PS. My JavaScript knowledge is extreme newbie with brain damage. I''m only beginning to understand some JS concepts. Thanks in advance!

The code as it stands is: JavaScript

Expand|Select|Wrap|Line Numbers

解决方案

Forget the code above as its not even close to what I should have posted. Sorry!
Here''s what I''ve got so far. I do not know how to get the Arrays to communicate and then have html code use the JS selected.

Thanks!

Expand|Select|Wrap|Line Numbers


I realize that with the amount of brain damage I have, I should really try something easier, like knitting. But, can anyone tell me what search terms might help me? Or, can someone point me to the code that I''m missing? Thanks! :D

My issue is that I can not figure out how to do the code bit that tells the computer what to do with the JS selection. I''m sure I can get the code to post the JS in a window, but that is not what I want. The code snippet I do have, make a playing field, for memory. This is not very useful. I have the complete code for the game, I just need the computer to use the JS file for the game and the HTML file for the other half of the game code and marry the 2. I thought that document.write wouldn''t do it, as it would just print whatever instead of do whatever.
Thanks!


My question I''d still like an answer to is:
1) What search terms does one use to figure out how to marry input choice with html page to get the js file chosen to be put into the html page. I would like to read more about this, but my search terms do not quite give me the write resources. All I get is how to make drop down navigation menus. :P

I did come up with a very silly, very newbie solution. Write the entire HTML page in JS such that one uses if else else else statements for all the possible choices. In this case, 1 IF and 11 else statements. Thus, if selection is 1a.js, then document write statement would be the javascript link to 1a.js file.

I''d still use the drop down menu for choices, but I''m not exactly sure if there is a line I need between the drop down menu and the if else statement.

2) My other question:

Given the newbie solution above, what is the "proper search terms" that will give me the right article to read that would help me with the newbie type solution?
Thanks!

signed perplexed who is researching how to write an HTML page completely in JS, a solution I was trying to avoid!

Yes, I''m communicating with myself. No problem, I did manage to connect with the solution to my other problem, thus didn''t need a response. :D People are busy, and I''m fine with that.


Naysayers:
Believe it or not, I do wait a considerable amount of time before I post my questions. Matter of a fact, I won''t be posting much JS questions only because I''m just beginning to connect with the language. Give it another year. Many of the questions I do have, I feel should wait until I''ve worked out at least the direction I should be searching in.
Many thanks! :D


这篇关于希望用户选择使用不同JS的游戏,但使用相同的HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆