在b.htm
加上:
<script>
function1('a');
</script>
function在前面定义好。。
反正就是打开b.htm时执行function1('a')就行了
加上:
<script>
function1('a');
</script>
function在前面定义好。。
反正就是打开b.htm时执行function1('a')就行了
解决方案 »
- 关于removeChild的问题,比较简单,但搞不清楚,先谢谢了
- 插入艺术字的这段代码 高人帮解释下 我新手看不懂
- 寻HTML TIP javascript 代码
- 这样创建XMLHTTP错哪里了呢?
- 100分,急,不要求代码只回答可行性!-无间隙连续滚动图片,鼠标经过图片停止滚动图片放大,点击图片进入图片所在文章的链接可否实现
- javascript验证 动态单选框
- js如何取得浏览器上的地址
- 请问有办法在消息框左边加上自定义的图标吗?急!!!!
- 用innerHTML如何换行输入
- 如何保证web页在ie和netscape间通用呀?
- 自从上过某一网站后,IE浏览器最上方的标题栏似乎被他做过手脚,总会显示他加上的文字!如何才能去掉!help me!
- 为什么在传递变量时"\"会丢失?
<SCRIPT LANGUAGE="JavaScript"><!--
function fullSize(sURL){window.open(sURL,'scrshot','width=500,height=375,top=20,left=20,directories=no , Toolbar = no, resizable = yes, menubar = no, ScrollBars = yes ');
}
--></SCRIPT><A HREF="javascript:fullSize('f01og01x.htm')"> <img src="f01og01.jpg" width=404 height=362 border=0 ALT = "Click to view at full size.">
为什么非要这样做呢?说说你的具体需求。
<body onload="javascript:function1('a')">
能否说详细些?
B.HTM页面中<BODY>标签的前面.
给个实例吧
我希望b.htm这个页面在被其它页面链接的情况下不调用function1这个函数,只有在被a.htm这个页面链接时才调用b.htm中的function1这个函数。
<html>
<a href='b.htm'>b.htm</a>
</html><!--b.htm-->
<html>
<script>
function function1() {
if(!/\/a\.htm$/i.test(document.referrer)) {
return;
}
// add your codes here ...
}window.onload = function1;
</script>
</html>
看了你的方法,对我的问题很有启发意义那么请问大家:
a.htm该怎么通过链接传一个参数给b.htm,而b.htm又该怎么得到这个参数呢?
<html>
<form action='b.htm?a=1' method=post>
</form>
<a href='javascript:document.forms[0].submit'>b.htm</a>
</html><!--b.htm-->
<html>
<script>
function function1() {
if(!/\/a\.htm$/i.test(document.referrer)) {
return;
}
alert(window.location.search);
// add your codes here ...
}window.onload = function1;
</script>
</html>
function submit() {
[native code]
}请问何故?
我的a.htm按照你的方法做过以后,点击链接后显示
function submit() {
[native code]
}很奇怪,请问何故?还有在b.htm中怎么得到a.htm传的变量a的值呢?