473,395 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Passing a JavaScript variable as the src of an EMBED

polymorphic
I am no longer good at Javascript and need help. I'm trying to embed pdf files in html then build some sort of navigation between the pdfs via the pdf numbered file name.

I can generate the javascript functions to extract and manipulate strings, ints, etc but can't seem to deal with the variables I produce.

For instance, if current embedded pdf filename is "1.pdf" and button "Next" is clicked then embed "2.pdf". I cannot seem to get the logic for generating the variable to change the pdf filename. I suppose that I can store a variable in a hidden textbox or an iframe but I do not know how to get the variable back out to insert into the html that will embed the pdf.

Say I have a text box as so:
Expand|Select|Wrap|Line Numbers
  1. <INPUT TYPE = "hidden" name = "currentPage" value = variableA ID="Hidden1">
how do I populate and get variableA out and put it into my embed tag:
Expand|Select|Wrap|Line Numbers
  1. <embed> src = "variableA" </embed>
[Please use CODE tags when posting source code. Thanks! --pbmods]

any help is appreciated.

cj
Jul 19 '07 #1
2 4295
pbmods
5,821 Expert 4TB
Changed thread title to better describe the problem.
Jul 19 '07 #2
acoder
16,027 Expert Mod 8TB
Get the value of the hidden field by using, e.g.
Expand|Select|Wrap|Line Numbers
  1. var variableA = document.getElementById("Hidden1").value;
Give the embed tag an id and set the src property using
Expand|Select|Wrap|Line Numbers
  1. document.getElementById(embedID).src = variableA;
Nov 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
1
by: bin_P19 P | last post by:
the code i have got is as follows and now im stuck <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Shopping...
1
by: Tim J | last post by:
Hi all I've got a html doc with <embed src="url.svg"> in it however, I'd like the source to be a javscript variable (which will depending on an if, be a different filename on loading) is...
1
by: richardscheff | last post by:
Video selector works for IE but not other browsers. for not IE <object ID='Player' data="video/dodgeball.wmv" type="video/x-ms-wmv" width="320" height="280"> <param name="filename"...
5
by: Jake G | last post by:
I have a flash word verification doohickey running on a page that submits an email (problem with a spammer). The code for the flash is...... <td width="109"<div id="flashcontent"> <object...
3
daJunkCollector
by: daJunkCollector | last post by:
I have the html/javascript posted below, I imagine the fix to my problem is something simple that I am overlooking. My script is a little bit of html and javascript, and there is an embedded flash...
9
by: Morlaath | last post by:
Is there a way to embed php within javascript code? I know that php is server side and js is client side. For instance when working with jsp, you can imbed jsp scriptlets within the js code. e.g...
1
by: Wolfman | last post by:
Hi gang! I've been searching for a solution to this problem extensively but nothing really hits the mark. I have a descriptive popup page that contains a PayPal order button. The normal PayPal...
3
by: Wolfman | last post by:
Hi guys I thank you for being the most helpful and responsive tech group around, and I have a new one for you. Have you ever embedded Hulu on a page before? I use it quite extensively in popup...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.