在地址栏中调用页面的javascript函数 [英] Call javascript function of a page in address bar

查看:65
本文介绍了在地址栏中调用页面的javascript函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我是C#程序员,对javascript不太了解.
我需要运行一个javascript函数,该函数在php页面中加载的js文件中定义.我尝试了许多代码来运行该功能,例如以下模式:

http://TestWebsite.com/TestPage.php#javascript:TestFunction()

http://TestWebsite.com/javascript:TestFunction()

但是他们都不起作用.
谁能帮我吗?

Hi,
I am a C# programmer and I do not know so much about javascript.
I need to run a javascript function which is defined in a js file that is loaded in a php page. I tried many codes to run that function for example like this pattern:

http://TestWebsite.com/TestPage.php#javascript:TestFunction()
or
http://TestWebsite.com/javascript:TestFunction()

But none of them worked.
Can anyone help me?

Mark Nischalke写道:
Mark Nischalke wrote:

您必须引用自己页面中的javascript文件,以便将其加载到浏览器的上下文中.


当然,您的方法都不起作用.在尝试使用该主题之前,请至少对此主题进行一些研究.</blockquote>

不,你不明白我的意思.我不写JavaScript. javascript函数用以下语言编写:
< a href ="http://s6.travian.ir/mt-core.js?4a259"> http://s6.travian.ir/mt-core.js?4a259</a>

并在以下位置宣布:
< a href ="http://s6.travian.ir/dorf1.php"> http://s6.travian.ir/dorf1.php</a>
< pre>& lt; html>
& lt; head>
& lt; title> Travian ir6& lt//title>
& lt;元名称="content-language" content ="ir"/>
& lt; meta http-equiv ="cache-control" content ="max-age = 0"/>
& lt; meta http-equiv ="imagetoolbar" content ="no"/>
& lt; meta http-equiv ="content-type" content ="text/html; charset = UTF-8"/>
& lt; script src ="mt-core.js?4a259" type ="text/javascript">& lt;/script>
...
& lt;/head>& lt;/html></pre>
我想调用这些功能之一.
我应该在浏览器的地址栏中写些什么来调用它?
(我不想自动运行它,我想在未经页面许可的情况下手动运行它).

You must reference the javascript file in your own page so it loads in its context in the browser.


Of course none of your methods work. Please do at least a little research on the subject before attempting to use it.</blockquote>

No, you did not understand my mean. I don''t write javascript. The javascript functions are written in:
<a href="http://s6.travian.ir/mt-core.js?4a259">http://s6.travian.ir/mt-core.js?4a259</a>

And are announced in:
<a href="http://s6.travian.ir/dorf1.php">http://s6.travian.ir/dorf1.php</a>
<pre>&lt;html>
&lt;head>
&lt;title>Travian ir6&lt;/title>
&lt;meta name="content-language" content="ir" />
&lt;meta http-equiv="cache-control" content="max-age=0" />
&lt;meta http-equiv="imagetoolbar" content="no" />
&lt;meta http-equiv="content-type" content="text/html; charset=UTF-8" />
&lt;script src="mt-core.js?4a259" type="text/javascript">&lt;/script>
...
&lt;/head>&lt;/html></pre>
And I want to call one of those functions.
What should I write in address bar of browser to call it?
(I do not want to run it automatically, I want to run it manually without getting permission of the page)

推荐答案

您必须引用javascript文件在您自己的页面中,以便将其加载到浏览器的上下文中.

<script src="..." />

当然,您的方法都不起作用.在尝试使用该主题之前,请至少对此主题进行一些研究.
You must reference the javascript file in your own page so it loads in its context in the browser.

<script src="..." />

Of course none of your methods work. Please do at least a little research on the subject before attempting to use it.


这篇关于在地址栏中调用页面的javascript函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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