开发者

javascript function to catch return value

I have a function like this

<script type="text/javascript">
function result()
{
   return "string";
}
</script>

I need to get this string value in to var

var gotresult= ???? how to get here that result value开发者_StackOverflow中文版


Fix your HTML to use the correctish MIME type (text/javascript), spell return and function (thanks Rob) correctly then just replace your question marks with result().


Are you simply talking about var gotresult = result();? Or does that not work for some reason?


var a;function result(){ return "string";}function setVal(){ var a=result();alert(a)document.getElementById('test').innerHTML=a;}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜