0
<script src="recentimg.js" type="text/javascript"></script>

<script language="JavaScript">
imgr = new Array();
imgr[0] = "noimage.jpeg";
RandomImg = true;
</script>

当我点击按钮时..我让它加载随机图像..我的意思是加载这个脚本onclick

<script language="JavaScript">
imgr = new Array();
imgr[0] = "noimage.jpeg";
RandomImg = false;
</script>

我试过了

<input type="button" onclick="write()" value="load">
<script language="JavaScript">
function write(){RandomImg = false;}
</script>

但它不起作用..

注意:我的网站不支持 php、ajax 加载


更新------------完整代码..

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' type='text/javascript'></script>

<script language="JavaScript">
imgr = new Array();
imgr[0] = "https://dl.dropbox.com/u/36050019/Bukraa.coM/noimagejpeg.jpeg";
showRandomImg = true;
boxwidth = 298;
cellspacing = 8;
borderColor = "#F5F5F5";
bgTD = "#000000";
thumbwidth = 80;
thumbheight = 64;
fntsize = 16;
acolor = "#666";
label = "اخبار مصر";
aBold = true;
icon = " ";
text = "comments";
showPostDate = false;
summaryPost = 0;
summaryFontsize = 10;
summaryColor = "#666";
icon2 = " ";
numposts = 4;
home_page = "http://bukraa.blogspot.com/";
</script>
<style>table td {
padding: 0px;
text-align: right;
}</style>
<script src="https://dl.dropbox.com/u/36050019/Bukraa.coM/recentpost.js" type="text/javascript"></script>

.....我想在点击时将标签更改为

label = "توب نمبر";

然后当我单击按钮时.. 我的代码显示没有刷新页面的新标签提要我可以使用 java 脚本 jquery 吗?

4

1 回答 1

1

朋友,你想达到什么目的还不清楚。但是,如果您希望在单击某个对象时执行您的函数,只需添加

$("#clickme").click(function() {
  //script
});

围绕你的脚本。

例如:

<script language="JavaScript">
$("#clickme").click(function() {
imgr = new Array();
imgr[0] = "noimage.jpeg";
RandomImg = false;
});
</script>

<div id="clickme">
Click Me!
</div>

这是关于 jsfiddle 的示例:http: //jsfiddle.net/CWBZz/3/

于 2013-02-13T21:30:02.287 回答