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;}
精彩评论