可以說我有一個形象的使用的代碼顯示:JS + HTML,得到SRC使用JavaScript
<img src="image.png"/>
我想使用JavaScript來定義SRC,你會怎麼做這樣的事情
<script>
function getImage()
{
return "image.png";
}
</script>
<img src="Javascript:getImage()"/>
UPDATE:
我需要它與DivX播放器工作,通過JavaScript
獲取視頻網址paramater<object classid="clsid:*************" width="320" height="260" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab">
<param name="custommode" value="none" />
<param name="autoPlay" value="true" />
<param name="src" value="Javascript:GetURL()" />
<embed type="video/divx" src="Javascript:GetURL()" custommode="none" width="850" height="400" autoPlay="true" pluginspage="http://go.divx.com/plugin/download/">
</embed>
</object>
有沒有人有這個想法?
也許這將幫助: http://stackoverflow.com/questions/116967/img-src-tags-and-javascript – Chris