I have a div tag inside a table cell and and a hyperlink tag in another cell and on i want open a specific url onmouseover on hyperlink inside the div tag.the url is to my pdf file.Please anyone tell me how can i do this thorugh Javascript or anyother method
Asked
Active
Viewed 3.6k times
1
-
Can you please rewrite your question to use full, logical sentences? This is pretty hard to understand. – mrtsherman Jan 18 '12 at 06:06
-
Could you give sample code? It's hard to get what you're trying to do here. – Julien Bourdon Jan 18 '12 at 06:06
-
Brother I want to open the specific URL inside a div tag on same page where the div is placed. – Adeel Aslam Jan 18 '12 at 06:24
-
http://stackoverflow.com/questions/291813/best-way-to-embed-pdf-in-html see this link – CBusBus Jan 18 '12 at 06:31
2 Answers
8
Something like this:
<table>
<tr>
<td>
<a href="/pdfs/test1.pdf" onmouseover="previewUrl(this.href,'div1')">google</a>
</td>
<td>
<div id="div1" style="width:400px;height:200px;border:1px solid #ddd;"></div>
</td>
</tr>
</table>
<script>
function previewUrl(url,target){
//use timeout coz mousehover fires several times
clearTimeout(window.ht);
window.ht = setTimeout(function(){
var div = document.getElementById(target);
div.innerHTML = '<iframe style="width:100%;height:100%;" frameborder="0" src="' + url + '" />';
},20);
}
</script>

jerjer
- 8,694
- 30
- 36
-
Brother excpet google or google mail all links are opening but why the google is not opening u know any reason ? – Adeel Aslam Jan 18 '12 at 07:12
-
0
If you mean you want to open a new page on mouse over, then:
//add onmouseover to your hyperlink
<a href="#" onMouseOver="open_new_window(url);">Open Hover Window
//then js
function open_new_window(url) {
window.open(url,"some_name","width=300,height=200,left=10,top=10");
}
Did you mean something like that

Sudhir Bastakoti
- 99,167
- 15
- 158
- 162
-
No I dnt this i want to open url on same page inside a the div tag not on whole page – Adeel Aslam Jan 18 '12 at 06:23