Jump to content

A href inside a A href? Javascript


thefreebielife

Recommended Posts

cant you just change the void statement for the url?

and you also need to close your image tag

 

<a href="http://www.phpfreaks.com" onmouseover="return overlib('<b>Description:</b> <?=$od; ?><br><b>Requirements:</b> <?=$oi;?>');" onmouseout="return nd();"><img src="<?=$oimage;?>" border="0" ></a><br>

It's closed, i didn't paste the whole code.

 

What I mean is something like this:

 

<a href="javascript:void(0);" onmouseover="return overlib('<a href="phpfreaks.com">Show Me this Offer</a><br><b>Description:</b> <? echo "$od"; ?><br><b>Requirements:</b> <? echo "$oi"; ?>');" onmouseout="return nd();"><img src="<? echo "$oimage"; ?>" border="0"</a><br>

 

It doesn't work correctly if I put that in.

ahh ok.....

what you either need to do is store the string in a variable or change the " to " like this ...

 

<script language="JavaScript" type="text/JavaScript">
function test(str){
document.getElementById("test").innerHTML = str;
}
var myStr = '<a href="test.htm">Link 1</a>';
</script>
<a href="javascript:void(0);" onmouseover="test(myStr)">test</a><br>

<a href="javascript:void(0);" onmouseover="test('<a href="test.htm">Link 2</a>')">test</a><br>

<div id="test"></div>

 

Theres a section of the HTML spec about this here ....

http://www.w3.org/TR/html4/appendix....html#h-B.3.2.1

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.