Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Call an object with onclick

Call an object with onclick

Call an object with onclick

Hi all

Newbie type question, please be gentle.

Need to convert the following code to call an object to display the .pdf as opposed to showing the .pdf in the window.

CODE -->

<span title="Click/tap to download vehicle's details" onmouseover="this.style.cursor='pointer';" onclick="window.open('pdfs/6562.pdf','_parent',....</span> 

This works in the page

CODE -->

<div style="width:767px;margin:0 auto;">
Click on return button to exit
<object width="767" height="1068" data="pdfs/6562.pdf"></object>


Chris pc2

RE: Call an object with onclick

Can you further define the difference between "display the pdf" and "showing the pdf"?

RE: Call an object with onclick

You're making this more confusing.

"...to display the .pdf as opposed to showing the .pdf..."

If they should be the same, why do you perceive them to be opposed?

RE: Call an object with onclick

I'm assuming you mean "Need to convert the following code to call an object in which to display the .pdf [inline] as opposed to displaying the .pdf in the [parent]window.".

You can either set up a show/hide div visibility toggle and/or play with setAttribute to swap content.


Beware that the inline object display of PDF may not be mobile-friendly, especially with a gaping hole on your page of 767x1068 before the PDF is requested.

RE: Call an object with onclick

Found a suitable workaround by using 'onclick="window.open(' to open a new .html file in '_parent'.

CODE -->

<!DOCTYPE html>
<body style="background-color:#D6EBEF;">
	<div style="width:100%;margin:0 auto;">
		<h1>Unable to view vehicle's details? <a href="6562.jpg">Tap/click here</a></h1>
		<object width='100%' height='1068' data="6562.pdf"></object>

The code allows users without a suitable .pdf plugin on their device's browser to view the .pdf as a .jpg instead.

Thanks again to spamjim for your input.

Chris pc2

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close