HTML Using JavaScript
Nov 6, 2007
Usin a JavaScript write a script that inputs five numbers and determines and outputs HTML text that displays the number of negative numbers, the number of positive numbers, and the number of zeros input. Code:
View 8 Replies
ADVERTISEMENT
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
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
View Related
Jul 20, 2006
I have an XML file that among other things has the following node.
As you can see it contains HTML tags.
<description lang="en">
<![CDATA[
<div class="descrBoxRight" style=" top:250; left:200">
ENGLISH <b>ENGLISH</bENGLISH ENGLISH
</div>
]]>
</description>
With javascript, in Mozilla, I easily retrieve the content of the
XML "description" tag using the following line of code
var myStuff = myDescrNode.textContent;
However, in IE (6.0)
var myHTML = myDescrNode.textContent;
and
var myHTML = myDescrNode.innerText;
do not work, resulting in myHTML being undefined.
Alternative solutions? Should I remove the CDATA tag
and use a completely different method?
View 2 Replies
View Related
Sep 12, 2006
On the time sheet page i have created a years worth of entries in the
database for a user so that they may create entries ahead of time(for
holidays etc.).
My problem is that when i load the page, i display the current month
for that user and it displays:
Date Month Day TimeInMorning TimeIn Evening etc..
What i would like is that a user may update any field and click on a
save button which will update the field(s) that they have changed. I
ahve attempted in javascript to do this but i am failing.
View 3 Replies
View Related
Apr 27, 2006
I want to make a database which I can put on my USB flash drive, with a html interface, and maybe an xml database. Will I be able to do that?
View 1 Replies
View Related
Oct 4, 2006
I have a form that I would like to display a javascript calculation into the value field.
The code i Have is
<form name="form1" method="post" action="nextpage.asp">
<input type="text" name="textfield" value=" document.write(document.applets[0].getLHost());">
</form>
Basically I want the document.write(document.applets[0].getLHost()); to display as the value in the form field. But when I try this it literally displays the code.
View 1 Replies
View Related
Dec 14, 2004
I'm trying to select data from a database and put it into a javascript ticker. The data is inputted by visitors using a form. The problem is the javascript wont run when the data has <br /> in it.
var marqueecontent='<?php echo "".nl2br($row["EventText"]).""; ?>'
Is there anthing i can do here?
View 5 Replies
View Related
Feb 16, 2005
Im using a php simple cms program which allows me to use templates to format my content.
I need help in stripping out (removing) the generated <img src="url"> tag when i insert image. I want to use javacript so its post processed (after the server has interpreted the php code) because I only need to do this in one category of my content.
View 1 Replies
View Related
Dec 9, 2005
I want the form to hide the bottom two fields and display one or the other depending on what the nature of the enquiry is. Is there some HTML/ Javascript code that does this and can anyone point me in the right direction.
View 2 Replies
View Related
Nov 22, 2006
I need some help with Javascript and HTML entities. I am writing some code and I need to use quite a few HTML entities on alert boxes (messages in different languages)
Unfortunately Javascript displays the entities and not the equivalent caracther.
View 10 Replies
View Related
Jul 23, 2005
I'm learning/experimenting with some simple JS/html markup, running
an apache daemon and mozilla firefox browser in RH 9.
Let's say I run the following markup with one or more of lines 6-10
commented out:
1 <html>
2 <head>
3 <script type="text/javascript">
4 function showinfo()
5 {
6 width = window.screen.availWidth;
7 document.write("<br>screen width=
");
8 document.write(width);
9 document.write("<br>Date: ");
10 document.write(Date());
11 }
12 </script>
13 </head>
14 <body onload="showinfo()">
15 <p>
My question: is there a simple explanation to account for the 'unexpected'
behaviours below (Runs 1, 3, 5)?
Run 1: nothing in 6-10 commented out; output (expected more):
screen width=
Run 2: line 7 commented out; output (as expected):
1024
Date: Wed Apr 14 2004 20:55:58 GMT-0400 (EDT)
Run 3: lines 7, 9, 10 commented out; output (as expected, but unfinished loading):
1024
[ongoing hourglass indicating loading in progress]
Run 4: lines 7, 10 commented out; output (as expected):
1024
Run 5: lines 7-9 commented out; output (as expected, but unfished loading):
Date: Wed Apr 14 2004 22:46:49 GMT-0400 (EDT)
View 2 Replies
View Related
Jul 23, 2005
Is there any way i can show my excel chart on my web page.
View 2 Replies
View Related
Dec 14, 2005
I am looking for a package i found once that created excel style html
tables with javascript. It would do all sorts of things like column
resizing, sorting, rearranging etc.
I don't remember the name but I am sure there are similar packages
like this. Anyone have a list of links?
View 1 Replies
View Related
Jan 17, 2006
Here's my situation:
1. I have a web browser component that does not support Javascript
(well it does, but we've disabled it)
2. I have to display some HTML in it, where the user has a link titled
"Hide|Show Options" that can hide/show a particular section of the
HTML.
I have not found a way to achieve it without using Javascript or any
other scripting language.
Is it possible to do this using pure plain HTML?
View 3 Replies
View Related
Apr 17, 2010
I'm having some trouble naming variables in javascript. Actually, my html has multiple form names (form, form1, form2, etc..., and im just having trouble understanding how to access elements within.For example: I get error:Message: 'document.forms.form.bname' is null or not an objectWhen I use the following code:
var bname = document.forms["form"].bname.value;
And when I try this:
var bname = document.form.bname.value;
View 10 Replies
View Related
Aug 10, 2006
Is there any simple way of passing HTML variables from one HTML page to another HTML page without using PHP or messy URL extensions?
View 5 Replies
View Related
Jun 24, 2007
In the following code I am trying to print out the value of document.body.onclick from javascript:
<BODY onclick="alert('ok')">
...
<script type="text/javascript">
alert(document.body.onclick);
</script>
...
</BODY>
However, the alert in Javascript code prints out "undefined" when I open this page and not the actual value of onclick.
View 1 Replies
View Related
Dec 1, 2007
Basically, I have a button which when clicked, should write some html to the page at a specific location. Here's the html currently in the page Code:
View 8 Replies
View Related
Jul 28, 2005
I'm having some trouble implementing a popup in firefox. I attached some
simplified code at the bottom. This is part of a firefox extension. What
happens is that a popup window is created, the popup window updates it's
data depending on what is shown on the main window. The problem comes when i
click the 'X' to close the popup window. it crashes firefox, and closes all
firefox windows. can somebody help me with this? why does this happen? I'm
99% sure the error comes from the form in the html code.
window.getNode = function (t)
{//stuff}
window.printNode = function (node)
{//stuff}
window.updateWindow = function (num, tag, inner) {
outputWindow.document.outputForm.nodeNum.value = num;
outputWindow.document.outputForm.nodeTag.value = tag;
outputWindow.document.outputForm.innerHTML.value = inner;
}
//popup
window.outputWindow = window.open('', 'outwindow', 'width=500,height=500');
//add contents to window
outputWindow.document.write("<html><body><form name='outputForm'>Node
number:<input type=text size=20 name='nodeNum' value=''><br>Node tag:<input
type=text size=10 name='nodeTag' value=''><br>Inner HTML:<input type=text
size=50 name='innerHTML' value=''></form></body></html>");
document.onmouseover = getNode;
View 3 Replies
View Related
Feb 17, 2006
I'm trying to use client side JavaScript from an HTML file to open
and make changes to an Excel SpreadSheet using ADO w/ ODBC. What a
pain it is to do this. Anyways, I am able to open the excel file but I
don't know how to use ADO to work with it's contents. So far I have
the following code that works:
<html>
<script>
window.onload = function () {
var ExcelSheet;
var sConnect = "DRIVER={Microsoft Excel Driver
(*.xls)};DBQ=P:js-test.xls"
ExcelSheet = new ActiveXObject("ADODB.Connection");
ExcelSheet.Open(sConnect);
}
</script>
<body> =) </body>
</html>
Now that I have the sheet open, how do I manipulate it?
View 13 Replies
View Related
Feb 28, 2006
do you know if it's possible to call a python script in html page?? I want call my script pyhton and I have a html with javascript but I don't know how, do you have an example??
View 2 Replies
View Related
Jan 11, 2007
For a project I am working on, I need to retrieve links from html
documents. The easy part is to obtain 'plain' links like <A
HREF="http://site/path/document">, but when those links are
javascript'ized, the only robust solution needs to load the javascript
and dom document representation in the same way that browsers do. For
example, links in the form:
<A HREF="javascript:function_declared_before("arguments"));>
First I though that using spidermonkey (the mozilla javascript
interpreter) should be enough, but in that case, I dont have the
document structure elements (like document, window, document.history,
document.form.element, etc), so I tried parsing the document using a
library to build a tree representation of it, but that leads me to the
same problem again, that is, I have to represent all tree nodes as
javascript entities.
Anybody here have worked on a similar problem? What tools do you
think I should take a look?
View 3 Replies
View Related
Jan 23, 2007
I'm writing a program on Zimki, which I think uses SpiderMonkey as a server side Javascript engine.
My idea is to have an html file that someone else created, and look inside for cells in a table that have special known names, like name, description, etc. Then I want to figure out the <tr<tr/pair that encloses all of those special tags, and use that as a template to generate a bigger table from another datasource.
So, I'm wondering how I actually open a file and then parse it as html so I can poke around the DOM, all from the server side without involving a browser client.
View 2 Replies
View Related
Jul 20, 2005
I was wondering if there was a way to view the html code that javascript
produced since viewing the source code shows the javascript if statements
for netcrape and IE etc.
View 1 Replies
View Related
Dec 12, 2005
How would I go about simply populating an HTML select statement from a JavaScript function. You see I have several HTML select statements on one page which are identical (sometimes repeated multiple times) so I wanted to try and cut down on these multiple instances and just have the values hard coded once (in a JavaScript function perhaps) and then called whenever they are needed. Could anyone advice me please, would this be easy to do?
I have the following HTML select statement hard coded:
<select name="bodyFontType">
<option value="">Select Font</option>
<option value="Verdana">Verdana</option>
<option value="Arial">Arial</option>
<option value="Tahoma">Tahoma</option>
<option value="Trebuchet MS">Trebuchet MS</option>
</select>
Would I use an onLoad property on the select statement to call a function which creates an array and then pushes through the values?
View 2 Replies
View Related