Javascript Variable In Html Tag
Jul 23, 2005
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 this possible and if so, what is the syntax to put a javascript variable
inside an embed tag?
View 1 Replies
ADVERTISEMENT
Dec 13, 2011
I want to load an html div in a variable, modify it in another variable; and then change the document injecting the contents.
1. I load the html to be changed in a variable (code)
2. I modify an attribute of <param> using attr() and I put the result in a var (newcode)
3. I change the html in the doc
I've used the debugger, and all steps give the expected results, except of newcode.html(), which is a null string. Why?
[Code]....
View 8 Replies
View Related
Jul 23, 2005
I'm working on some code and am running into brick walls. I'm trying
to write out Javascript with Javascript and I've read the clj Meta FAQ
and didn't see the answer, read many similar posts (with no luck
though), and searched through the IRT.ORG Faqs
(www.irt.org/script/script.htm).
The Javascript is designed to open an popup window and then inside that
window call another script which will resize that window. There may be
another way around this but the reason I tried this approach initially
was that I wanted to call the onload handler in the popup window to
resize the image only after the image had completely loaded. I've had
some code in the primary Javascript file (showimage.js) before that
works if the image has been cached but on the first load, it doesn't
resize properly which tells me it is probably because it is trying to
resize the window based on the image size but it isn't completely known
at that point. So I removed that code and tried placing the resizing
code in the second Javascript file (resizewindow.js). BTW I've tried
other code to open a popup image and automatically size it ie Q1443 at
irt.org but that doesn't do exactly what we need.
Even if there is another way to do this with one file, I still want to
figure out why this isn't working in case I run into it in the future.
I thought what I would need to do to use document.writeln to write
Javascript would be to escape any special characters and to break
apart the script tag ie
document.writeln('</SCRIPT>');
would become
document.writeln('</SCR' + 'IPT>');
I have a HTML page and 2 Javascript files. All files are in the same
directory and have permissions set correctly.
Here are the 3 files (keep in mind wordwrap has jacked up the
formatting):
index.html
----------
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<SCRIPT type="text/javascript" LANGUAGE="JavaScript1.1"
SRC="showimage.js">
</SCRIPT>
</head>
<body>
Click the house<BR>
<A ONCLICK="newWindow1('house1.jpg','Nice House')"><IMG
SRC="house1thumb.jpg"></A>
</body>
</html>
showimage.js
------------
function newWindow1(pic,sitename)
{
picWindow=window.open('','','width=25,height=25,sc rollbars=1,resizable=1');
picWindow.document.writeln('<html> <head>');
picWindow.document.writeln('<SCR' + 'IPT type="text/javascript"
LANGUAGE="JavaScript1.1" SRC="resizewindow.js"></SCR' + 'IPT>');
picWindow.document.writeln('</head>');
picWindow.document.writeln('<body onload="resizewindow();">');
picWindow.document.writeln('<img src=' + pic + '>');
picWindow.document.writeln('</body> </html>');
picWindow.document.close();
}
resizewindow.js
---------------
function resizewindow()
{
// Do resizing here.
// Right now this isn't being executed
alert("resizing window");
}
Can anyone provide some pointers as to why this javascript is failing?
I'm using IE6 on Win2k and when I click on the image to open the popup
window, it does open the window but it is white with no content and the
system immediately goes from about 4% CPU usage to 100% and
consistently stays there until I kill that window with the task
manager.
View 9 Replies
View Related
Jul 23, 2005
if I have both javascript and aspscript,
how to get/retrieve the variable value in javascript into asp variable ?
View 4 Replies
View Related
Mar 3, 2011
Is there a way using a HTML button to set a JavaScript Variable. For Example;
OnClick Javascript Variable = HTML Variable?
or is there a way in JavaScript when you set your variable to = a HTML Variable?
View 2 Replies
View Related
Jan 22, 2006
how to pass a variable from HTML to Javascript? I have the following script which works OK if I input to str from the "prompt" box, but I want to input from a one-line text box on an HTML page. [Code]
View 3 Replies
View Related
Mar 25, 2009
In my wesite i am dynamically creating divs.there is one java script function with arguments as the div id.so how can i pass the different id on that function when the page is loading
View 1 Replies
View Related
Sep 12, 2011
I have two versions of this document. The first version uses only JavaScript and the standard PROMPT(). It works very well, but I would like to insert the name prompt into the page using the input command. For some reason the variable loaded in the HTML statement doesn't get passed to the JavaScript. Any ideas would be appreciated! This is only a small test page. Sorry I don't know about the [code] tag...
<!DOCTYPE html>
<html lang="en">
<head>
[code]....
View 1 Replies
View Related
Jul 25, 2011
What i am trying to do is get the username of the currently logged on user, then i want this to populate the "username" textbox on my form.
View 3 Replies
View Related
May 29, 2003
document.write('<td align=left BGCOLOR="#D9D9D9">
<a href=prod_show.php code_no='+thenumber+'>'+theitem+'</A></td>');
I have this javascript code in a php page. I need to access the value of '+thenumber+' into a variable that PHP would understand so that I can carry the "thenumber" value onto the next page and be a usable php value.
I tried:
PHP Code:
document.write('<INPUT TYPE=hidden NAME="number" VALUE="'+thenumber+'">')
but this didn't work probably because I have no clue as to how to do this. Any ideas?
View 19 Replies
View Related
Oct 18, 2007
I have two html pages:
page1.html and page2.html
I have a link on page 1 to page 2 and i would like to pass a variable
to page 2 so that it can be used in vbscript on page 2.
can I use:
page2.html?vaiable=test
then some sort of vbscript when page2 loads to grab the string from
the url?
View 2 Replies
View Related
Jan 29, 2011
Here is some code (I did not write) which counts down the minutes allowed on an exam. I want to get the minutes remaining when the user submits the exam and store this in a mysql database. My question is what is the variable which communicates the remaining time? And how do I put it in a form so I can pass it once the user submits?
<script language="JavaScript" type="text/javascript">
k = new Date();
n= k.getMinutes();
k.setMinutes(n+<? echo $minutes; ?>);
TargetDate = k;
BackColor = "palegreen";
ForeColor = "navy";
CountActive = true;
CountStepper = -1;
LeadingZero = true; .....
View 1 Replies
View Related
Apr 12, 2011
I'm using a form data reference, something like P-1234 for example to create a text file and a link to the file. This is during the construction of a new table or table row with javascript. I have an array of one or more references submitted via form using $_POST. On my action page I am creating a txt file P-1234. If I am creating a table ot table row using createElement(), one of the cells will have a link to the file. If the file is created as follows:
$File = $_POST['ref'][$i] . "txt";
After creating the cell
var Cell = document.createElement('td');
[code]....
I assume the link is inserted using innerHTML? If so, do I just append the filename to the end of the file path like this?
Cell.innerHTML = "http://localhost/Project/+File";
View 1 Replies
View Related
May 21, 2006
I have an html-file on my Harddisk, there is some javascript in it. Simplyfied it should work like this: The script should put the html-page delivered by the webadress http://www.codingforums.com in a variable called the Source.
View 2 Replies
View Related
Sep 9, 2009
I was wondering if anyone knew if you could usea javascript variable in an html form. I made a dateusing javascript (I need the 00/00/0000 format, and only in javascript could I get it).
<script LANGUAGE = "Javascript">
Variable for hours requested
var sday = 8
var checkhour
[Code]....
This is the part of the form where I want to enter it into as the default value
After this point I have no clue what to do. If needed i can post more code as well.
View 3 Replies
View Related
Mar 27, 2011
I need to include JavaScript variable inside the style tag, how can I do it? I have tried code like below but obviously it doesn't work
Code:
<html>
<head>
<script language="javascript">
function getNumber()
[Code]....
View 2 Replies
View Related
Jul 23, 2005
I have this problem in xsl wherein i want to access a variable in
javascript and use it my xsl. How would i access or use a javscript
variable in my xsl file?
View 5 Replies
View Related
Oct 22, 2006
i use the following script (from textbook) to restrict 160 character in
Message_cont textbox.
how can i to change the number of character to 70 if any double bytes
character detected in the textbox. Code:
View 2 Replies
View Related
Jul 20, 2005
I have two events in a form that I am passing. One is to a javascript
function, the other is to the same .asp page only with another action
to show different data.
Onchange is calls the function updateclasses, which in turn reloads
another drop-down list. It also reloads the .asp page, which
refreshes the data. My problem is that it refreshes the second
drop-down briefly, until the page reloads, but then resets the form.
How do i pass this data to the .asp?
I thought in the .asp, I could just do something simple like the
following, but wasn't sure of the correct syntax. is there a better
way?
view = request.querystring("view")
if view = "" then
view = "SciLink"
else
%>
<script language="JavaScript">
updateclasses(form1, 0, Student)
</script>
<%
end if
.........
View 7 Replies
View Related
Dec 12, 2005
I've got a URL in an include file like this :
<iframe src=http://www.blah.com?query=thevariable>
I want to be able to set 'thevariable' in the shtml page that calls that include and pass it to that string - I'm thinking that because I don't want to use php/asp that Javascript is the best way?
In PHP I'd do it like this :
<iframe src=http://www.blah.com?query=<?echo $thevariable;?>>
So how do I echo/insert the variable in the URL using javascript rather than PHP?
View 3 Replies
View Related
Feb 2, 2004
I need to display the variable from PHP to ( POP ) JavaScript
$mess = "ERROR .. Please Enter the name";
Display ( $mess ) in POP Windows JavaScript.
View 2 Replies
View Related
Mar 21, 2005
Not sure whether this should go in the JavaScript or VBScript/ASP section, but I'll try here anyway.
I have an ASP include file that contains both VBScript and JavaScript code. The VBScript processes some information and has an onChange event which calls a JavaScript function. Within this javascript function I want to access a recordset and retrieve a value using a variable from the javascript. Here's the code from the JavaScript section. Code:
View 1 Replies
View Related
Jul 21, 2006
Does anybody know how I can have a global variable in an HTML file? for
instance, I have a fuction (called aFunction() here) and during a
mousedown or up event the function is going to be called.
The third passing arugment or parameter is myGlobarVar. How can I make
this work? since myGlobalVar is defined in a different block of
javascript within the HTML file?
View 1 Replies
View Related
Jul 11, 2011
I'm trying to create a function which shows a hidden response when a button is clicked on.I also want to add the response to a variable which lists all the users responses.Here is my code now...
$(".yes").click(function () {var feedback = feedback + $(this).html();
$(this).parent().next("p").show("fast"); });
$(".no").click(function () { $(this).parent().next("p").next("p").show("fast"); });
$("#email").click(function () { alert(feedback) });
The bolded line is the part which isn't working.
View 2 Replies
View Related
Jul 12, 2011
$(function() {
window.resizeTo(925,10000);
$('input').removeAttr('checked')
var feedback = "Your Results: ";
$(".yes").click(function () {var feedback = feedback + $(this).html();
$(this).parent().next("p").show("fast"); });
$(".no").click(function () { $(this).parent().next("p").next("p").show("fast"); });
[Code]...
View 3 Replies
View Related
Aug 14, 2011
I have an Accordion working. To advance from section to section, I want to use both click on the Accordion bar or click a button in the section. This works so long as it is a straight pass through. (section=section+1). If the user goes back, out of sequence, to change a field in a prior section, things 'get out of whack'. I need some way to have a variable in the HTML (that does not show to the user) that identifies the Accordion section and pass it to the Accordion activate method. I currently have this in the HTML of each Accordion section.
[Code]....
View 5 Replies
View Related