开发者

javascript function to catch return value

开发者 https://www.devze.com 2022-12-28 07:30 出处:网络
I have a function like this <script type=\"text/javascript\"> function result() { return \"string\";

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

精彩评论

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