用script src=xxx为什么调用无效呢? 代码里只放 JS 语句.不放 <script>头尾document.write('111'); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 "\" -> "%5C""/" -> "/" 可以用下面的例子来进行测试.---------------------------------<html><head><title>test url encoding</title></head><script language="javascript">function doTest(){ alert(encodeURI(text1.value));}</script><body> <b>test url encoding</b> <hr/> <input type="text" id="text1" value=""> <input type="button" value="doTest" onclick="doTest()"></body></html> 恩,用js是可以了,但是用asp呢,可以做到吗?因为我想采集地址栏的参数,如www.a.com/b.asp?name=c,我需要c。代码如下,不知道如何做。<script language="javascript" charset="gb2312">var url = document.location, args; args = String(url).split('?'); if (args[1]) args = args[1]; document.write(('<DIV id=img1 style="Z-INDEX: 100; LEFT: 2px; WIDTH: 300px; POSITION: absolute; TOP: 43px; HEIGHT: 200px;visibility: visible;"><a href="http://www.kuaiyb.com/link.asp?')+ args);+document.write('";><img src="images/linkcode.jpg" border="0"></a></DIV>')var xPos = 300;var yPos = 200; var step = 1;var delay = 30; var height = 0;var Hoffset = 0;var Woffset = 0;var yon = 0;var xon = 0;var pause = true;var interval;img1.style.top = yPos;function changePos() {width = document.body.clientWidth;height = document.body.clientHeight;Hoffset = img1.offsetHeight;Woffset = img1.offsetWidth;img1.style.left = xPos + document.body.scrollLeft;img1.style.top = yPos + document.body.scrollTop;if (yon) {yPos = yPos + step;}else {yPos = yPos - step;}if (yPos < 0) {yon = 1;yPos = 0;}if (yPos >= (height - Hoffset)) {yon = 0;yPos = (height - Hoffset);}if (xon) {xPos = xPos + step;}else {xPos = xPos - step;}if (xPos < 0) {xon = 1;xPos = 0;}if (xPos >= (width - Woffset)) {xon = 0;xPos = (width - Woffset); }}function start(){img1.visibility = "visible";interval = setInterval('changePos()', delay);}function pause_resume() {if(pause) {clearInterval(interval);pause = false;}else {interval = setInterval('changePos()',delay);pause = true; }}start();</script> 简单点说,asp文件可以被<script src=xxx>正常的调用出来么?上面的代码就是我想调用的内容。但是啥反应都没有啊~如何是好 <SCRIPT language="vbscript" src="http://192.168.1.107/linkcode.asp"> 这一句是你调用JS的路径,如果你引用的是***.asp,那么原本在JS里的函数(例如document.write()) 就无法找到但是如果在页面上直接用了这段的话,那么在页面上当然可以调用<script></script>里的函数啦<script language="javascript" > document.write('111') </script> <SCRIPT language="vbscript" src="......"> 這種寫法只是把原來應該寫在頁面的script内容寫到文件裏面,通過這種寫法來調用罷了。這個寫法應該是不能滿足你的要求的。 但是我看有的网站就能通过<SCRIPT src="xxx.asp"> 来实现啊,他们是直接写成<SCRIPT src="xxx.asp?id=12345"> </script>然后让人加入到首页代码里,就成了对应的漂浮广告。 可以的的,只要asp返回输出的是标准js的代码就行最近我也在研究这个,但是在FF中不行,在chrome中只能执行一次 你那asp文件格式,不能按asp文件格式,而应用js文件格式。不能用<script language="javascript" > ,要直接用如document.write('111')。你那代码太长,我粗粗地看了一下,可以先去除第一句<script language="javascript" >和最后一句</script>,然后再试试。 ipad上web开发遇到的问题 ckeditor提交出现的问题 正则问题 关于javascript标签的src属性的问题,急!顶者有分! 关于JavaScript对ASP动态对象的控制。 中国龙网络浏览器Beta 1.0版本,今天正式发布 (续我研究 搜索引擎 (五) 浏览器篇) 把对象赋给变量的问题。。望高手解答 如何提取多选列表中被多选的值?(在线等待!火急) 急,请教以下代码什么意思? 新人请教各位大佬个问题 javascript可以实现类似php的一些功能吗? 想要一个滚动图片的代码,像msn网站首页左上角那个
"\" -> "%5C"
"/" -> "/" 可以用下面的例子来进行测试.
---------------------------------
<html>
<head>
<title>test url encoding</title>
</head>
<script language="javascript">
function doTest(){
alert(encodeURI(text1.value));
}
</script>
<body>
<b>test url encoding</b>
<hr/>
<input type="text" id="text1" value="">
<input type="button" value="doTest" onclick="doTest()">
</body>
</html>
var url = document.location,
args;
args = String(url).split('?');
if (args[1]) args = args[1];
document.write(('<DIV id=img1 style="Z-INDEX: 100; LEFT: 2px; WIDTH: 300px; POSITION: absolute; TOP: 43px; HEIGHT: 200px;visibility: visible;"><a href="http://www.kuaiyb.com/link.asp?')+ args);+document.write('";><img src="images/linkcode.jpg" border="0"></a></DIV>')
var xPos = 300;
var yPos = 200;
var step = 1;
var delay = 30;
var height = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
img1.style.top = yPos;
function changePos()
{
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = img1.offsetHeight;
Woffset = img1.offsetWidth;
img1.style.left = xPos + document.body.scrollLeft;
img1.style.top = yPos + document.body.scrollTop;
if (yon)
{yPos = yPos + step;}
else
{yPos = yPos - step;}
if (yPos < 0)
{yon = 1;yPos = 0;}
if (yPos >= (height - Hoffset))
{yon = 0;yPos = (height - Hoffset);}
if (xon)
{xPos = xPos + step;}
else
{xPos = xPos - step;}
if (xPos < 0)
{xon = 1;xPos = 0;}
if (xPos >= (width - Woffset))
{xon = 0;xPos = (width - Woffset); }
}function start()
{
img1.visibility = "visible";
interval = setInterval('changePos()', delay);
}
function pause_resume()
{
if(pause)
{
clearInterval(interval);
pause = false;}
else
{
interval = setInterval('changePos()',delay);
pause = true;
}
}
start();
</script>
这一句是你调用JS的路径,如果你引用的是***.asp,那么原本在JS里的函数(例如document.write()) 就无法找到但是如果在页面上直接用了这段的话,那么在页面上当然可以调用<script></script>里的函数啦
<script language="javascript" >
document.write('111')
</script>
這種寫法只是把原來應該寫在頁面的script内容寫到文件裏面,通過這種寫法來調用罷了。這個寫法應該是不能滿足你的要求的。
来实现啊,他们是直接写成<SCRIPT src="xxx.asp?id=12345"> </script>
然后让人加入到首页代码里,就成了对应的漂浮广告。
最近我也在研究这个,但是在FF中不行,在chrome中只能执行一次
不能用<script language="javascript" > ,要直接用如document.write('111')。你那代码太长,我粗粗地看了一下,可以先去除第一句<script language="javascript" >和最后一句</script>,然后再试试。