小编Ade*_*ram的帖子

使用javascript上传图片

我正试图Object在客户端获取javascript 图像以使用jQuery发送它

<html>
<body>
<script language="JavaScript">
function checkSize()
{
    im = new Image();
    im.src = document.Upload.submitfile.value;
if(!im.src)
    im.src = document.getElementById('submitfile').value;
    alert(im.src);
    alert(im.width);
    alert(im.height);
    alert(im.fileSize);

}
</script>
<form name="Upload" action="#" enctype="multipart/form-data" method="post">
   <p>Filename: <input type="file" name="submitfile" id="submitfile" />
   <input type="button" value="Send" onClick="checkSize();" />
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

但是在这个代码仅alert(im.src)是显示src文件,但alert(im.width),alert(im.height),alert(im.filesize)不能正常工作和报警0,0,undefined分别.请告诉我如何使用javascript访问图像对象?

javascript

10
推荐指数
1
解决办法
6万
查看次数

javascript void函数

可能重复:
"javascript:void(0)"是什么意思?

我想问一下javascript:void(0)

<input type='submit' name='btn' value='submit' onClick='javascript:void(0)' />
Run Code Online (Sandbox Code Playgroud)

你能解释一下void(0),它是内置函数吗?是关键字'javascript'告诉代码是javascript语言?如果你知道它的任何奇迹请与我分享,,,, thankx注意:同样的事情我打字4次,以满足stackoverflow标准...

javascript

6
推荐指数
1
解决办法
3万
查看次数

Javascript函数的复杂方式

我观察了一个不同的(对我不同)编写javascript或jquery函数的方法,你们好好指导我这个工作.

(function () 
{
//some statements of javascript are sitting here
//some statements of javascript are sitting here
//some statements of javascript are sitting here
//some statements of javascript are sitting here
//some statements of javascript are sitting here
}()); 
Run Code Online (Sandbox Code Playgroud)

我真的不理解(function(){}());.

没有人在呼唤它,但它正在被正确调用.

如果您知道任何教程,关注它,那么告诉我.

javascript

0
推荐指数
1
解决办法
75
查看次数

Console.log()正在打印同一个变量的两个不同值

我正在运行一个代码,我与你分享,这很简单,在两个不同的console.log()命令的情况下,它返回两个不同的结果.这里的".filter_me"类被分配给一个锚,

$(".filter_me").each(
    function(index,value)
    {    
        console.log(index+" is index and "+value+" is value.");
        //output of above line is "0 is index and "http://www.ex.com/2 
        //is value"{for first anchor,http://www.ex.com/ is base url and
        //2 is value of href of first anchor}
        console.log(value);
        //output of above line is <a href="2" class="filter_me">clk</a>
    });
Run Code Online (Sandbox Code Playgroud)

那么为什么在第一种情况下

value = http://www.ex.com/2

在第二种情况下

value = <a href="2" class="filter_me">clk</a>

javascript jquery

0
推荐指数
1
解决办法
160
查看次数

标签 统计

javascript ×4

jquery ×1