Guy Guy - 1 year ago 71
HTML Question

Using an second Onclick event to call JS

I'm using an Onclick that opens a URL inside an iframe.
It works great as an HREF link, but I've decided to change my second URL into JS function instead of typing it in each of my links.

Here is my added JS:

<script type="text/javascript">

function Link() {
document.getElementById("TestMe").src = "";


This is my original Cell link that I'm trying to adjust to be used with the top script. I actually need to change the string
into a

<td bgcolor="#a7d331" height="10" align="center" style="cursor:pointer" onclick="''); document.getElementById('TestMe').src=''"><font face="Arial" color="FFFFFF" size="4" alt="English">Some Link</font></td>

Here is my iframe:

<iframe id="TestMe" src="" frameborder="0" scrolling="no" width="400px" height="400px"></iframe>

Answer Source

Replace the assignment with the function call.

onclick="''); Link();"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download