Gathering Userinput For A Small Calculator?

Mar 4, 2009

What i am trying to do is the following: I read a tutorial on objects and thought i would try it out. The tutorial taught me how to make a function calculating the areal and circumspherence of the circle where the user input would be the radius.

To sum up: I want to make it possible for the user to write, say, "2" in the form text field and click "Calculate" and then the text will appear w/o reloading the page. I could easily do this by removing the objects but as i am training my object skills i would like to know if it is possible to do this with objects?

The problem is that i dont know how to take the user input. I know that in PHP it is "$_POST["name"]" but what is it in JS? And is it possible to jump into PHP and use $_POST inside the JS script or how can this be done?

This is my code so far (It prolly looks strange but i really dont know how to get it to work).

<script type="text/javascript">
function Circle(radius){
this.radius = radius;
this.getArea = function(){

[Code]....

As you can see i have a predefined object: bigCircle. What i want to do is change the new Circle(100) to new Circle(USER INPUT HERE).

View 4 Replies


ADVERTISEMENT

When I Try To Transform It Using IWebkit To Form Using Small Fields, The Calculator Does Not Work?

Oct 25, 2011

I have a HTML/Javascript code which dynamically calculates the entries and gives the grand total.I have it working in table form using textboxes, but when I try to transform it using iWebkit to Form using small fields, the calculator does not work.I want to simply subtract 1 text field from another and user presses a button and gives an answer in a 3rd text field

THIS IS THE GENERIC HTML USING JAVASCRIPT WHICH WORKS FINE....

<html>
<head>
<center>CALCULATOR NOTEPAD++</center>[code]......

View 3 Replies View Related

Redirecting A Site While Gathering Data

Sep 2, 2004

I have a website contains a login screen. When someone logs in it redirects them to a website.

Ok, I need to continue to redirect but I also need to be able to record
there login names to a database or text file.

My boss would like me to keep a record of who logs in during the day.
Is this possible? Code:

View 1 Replies View Related

Small Calendar

May 15, 2006

I wanted a small calendar for a web page that is created for the current month and highlights the current day and a date passed in. I also added a variable to show text when the cursor is over the highlighted dates. It's nothing special, but I like it and thought I'd share it. Here is the code and it is attached for downloading as well.

Let me know what you think of it.

<html>
<head>
<title>Calendar</title>
<script type="text/javascript">

var month = ["January","February","March","April","May","June","July","August","September","October","November","December"];
var moDays= [31,28,31,30,31,30,31,31,30,31,30,31];

function display(d,txt) {

var highlightDate = new Date(Date.parse(d));
var flag = false;

var startDate = new Date();
startDate.setDate(1);

if (new Date(startDate.getFullYear(),1,29).getDate() == 29) moDays[1] = 29;

var endDate = new Date();
endDate.setDate(moDays[endDate.getMonth()]);

if (highlightDate >= startDate && highlightDate <= endDate) flag = true;
if (!txt) txt = "";

var start = 0 - startDate.getDay();
var end = endDate.getDate() + (7 - endDate.getDay());

var r = document.getElementById('calendar').insertRow(0);

for (i = start; i < end; i++) {
if ((i - start - 1) % 7 == 0 && i != start) {
r = document.getElementById('calendar').insertRow(-1);
r.className = 'newRow'
}

var c = r.insertCell(-1);
if (i > 0 && i <= endDate.getDate()) {
c.innerHTML = i;
if (i == new Date().getDate()) {
c.title = 'Today'
c.className = 'selectedCell'
} else {
c.className = 'newCell'
}
if (flag && i == highlightDate.getDate()) {
c.title = txt;
c.className += ' highlightedCell'
}
} else {
c.innerHTML = '&nbsp;'
c.className = 'hiddenCell'
}
}
var title = document.getElementById('calendar').rows[0].cells[0];
title.innerHTML = month[startDate.getMonth()] + ' ' + startDate.getFullYear();
title.colSpan = 7;
title.className = 'title'
}

</script><style type="text/css">
#calendar {
position: absolute;
color: navy;
font: italic 75% sans-serif;
margin: 2px;
padding: 1px;
background-color: lightcyan;
border: 1px solid gray;
}
TR.newRow {
background-color: white;
}
TD.newCell {
text-align: right;
margin: 1px;
padding: 2px;
border-right: 1px solid lightskyblue;
border-bottom: 1px solid lightskyblue;
}
TD.selectedCell {
background-color: cyan;
text-align: right;
margin: 1px;
padding: 2px;
border-right: 1px solid lightskyblue;
border-bottom: 1px solid lightskyblue;
}
TD.hiddenCell {
background-color: lightcyan;
}
TD.title {
font: bold 110% sans-serif;
text-align: center;
border-bottom: 1px solid skyblue;
}
TD.highlightedCell {
background-color: palegoldenrod;
}
</style>
</head>

<body onload="display(&#3905;/25/2006','Adam's Birthday');">

<table id="calendar"></table>

</body>

</html>

View 1 Replies View Related

Small Div Popup

Feb 20, 2005

how forum's get divs to popup once they click a link? Like the "Quick Links" in sitepoint's navigation.

View 15 Replies View Related

Small Div Above (hover) A Big One?

Feb 5, 2010

have a small div above (hover) a big one.I assign onmouseover and onmouseout events to the wrapper div.For image caption roll-over animation.The problem is when the mouse is above the caption itself, causing an unwanted result(probably event bubbling).

And another problem: sometimes when you move mouse from outside to container you get a a triple debug sequence: (it should be just 2): -I am over- -I am out- -I am over-(firebug console)How to make it work? (no jquery)must work on all browsers.[URL]The wanted result:When mouse moved over the image, only mouseover event should be raised once!When mouse moved out from the image, only the mouseout event should be raised.when mouse is over the captionm it should be treated as if the mouse is still on the image. (no flickering)

View 2 Replies View Related

JQuery :: Small With Expanding Div?

Aug 14, 2011

I'm very new to JQ, I was looking for a solution to expand a div on mouse hover from its center to display some dynamic text wrapped in a code tag, I found and tried to fit to my needs this little piece of code, however is not exactly what I'm trying to do.

[Code]...

View 1 Replies View Related

Image Zoom Too Small

Dec 1, 2006

Can someone tell me why the image isn't zoomed all the way to its max when clicked on? You have to click on the zoomed image to get it to its max dimensions. Why does it do this and how do I fix it so it will max out in a separate window when you click on the thumb? Code:

View 2 Replies View Related

Can't Click On SWF When Small Size In Mac OSX

Aug 1, 2009

I have this website here [URL] If I use PC, I can drag and change volume on top left just fine. But if I use Mac OSX, either Safari or Firefox, I cannot drag the volume in the Flash, although I can see the mouse turn into pointer.

Where is the SWF: [URL]

View 1 Replies View Related

Small Popup Calendar

Apr 10, 2001

I would like to find a small calendar that I can use to allow people to choose a date. I am planning on placing a small icon to the right of my date fields to allow people to choose the date from a calendar. It doesn't need to be full sized. I'm using ASP for scripting, but a control is an option (com or activex).

View 2 Replies View Related

Need Small Popup For Definitions

Jan 23, 2007

What I am kooking for is not really a pop-up but more like a tool-tip. I was not sure what else to call it. What I need is a small little area with a different background color and perhaps a border to open next to a word when the symbol next to it is clicked on. This word or phrase would be in a sentence that would require some further explanation or definition.

I guess this would be similar to how someone like iStock Photo does with their thumbnails only it will require a click as opposed to a rollover and it will not be an image, just some text.

View 2 Replies View Related

Small Image Gallery

Aug 21, 2007

I have an "image gallery". I have four links that go to external pages, not defined yet, and one main image. When rolling over each link, the main image should change to the corresponding one. When I take the javascript and meat of the html out of context it works. When I use it on this page where it is supposed to be used, it does not work. The error console tells me my functions (switch_One() etc.) are not defined. Code:

View 3 Replies View Related

Small Script: Works In IE But Not Firefox?

Sep 23, 2009

The following function is called when the user selects "other" from a drop down menu (<OPTION>).

IE it works great, in Firefox I get the following error:

Ele1 is undefined
- Ele1.removeChild(Ele0);

Code:

function buildTextBox() {
var Ele0 = document.getElementById("LAC_Littmann.color");
Ele0.innerHTML = "";
var Ele1 = Ele0.parentElement;

[Code]....

View 1 Replies View Related

Content Positioning W/ Small Javascript

Mar 25, 2007

i made this javascript using the new "screen.width" property, which would make it easy to center content in a webpage no matter what the screen resolution is. Here it goes:

<html>
<head>
<script type="text/javascript">
function pos_center() {
var content = document.getElementById("carrier")
var width = screen.width
var contentwidth = content.offsetWidth
value = parseFloat((width - contentwidth)/2)
content.style.marginLeft = value }
</script>
</head>
<body
<div class="body" id="carrier">
</div>
</body>
</html>

The "body onload" makes the page first load all the way to the left, and then after completely loading switches the content to the center, that is dynamically gross.
Now, instead of using the "body onload", is there any other way that i can make the content appear. Seeing that there is no "onbeforeload", there must be another way to solve this.

View 1 Replies View Related

Small Hide/show Region Bug

Jun 7, 2005

Hoping someone could solve this small problem of mine. I have numerous regions on a page that can be hidden/shown, the problem is i get a 'Line 8 Character 30 'id' is not defined' javascript browser error, but it works!

here is the code the error appears in:

PHP Code:
<script language="javascript" type="text/javascript">
/* This goes in the head section */
window.onload = function() { document.getElementById(id).style.display = 'none' }

function toggle(link, id) {
    var div = document.getElementById(id);
    if (div.style.display == 'none') {
        div.style.display = 'block'
        link.innerHTML = 'Hide Forms'
    } else {
        div.style.display = 'none'
        link.innerHTML = 'Show Forms'
    }
}
</script>

The code for the hide/show region is below.

PHP Code:
[ <a href="#id3" onclick="toggle(this, 'id3'); return false;">Show Forms</a> ]</div>
<div id="id3" style="padding: 10px; display: none;">
SHOW/HIDE CONTENT HERE!
</div>

View 4 Replies View Related

Making One Loop From Many Small Loops?

Nov 27, 2010

How would I make this into one Loop using all same variables? Right now I can only get his program to work with separate loops

Here is the Coding
script type="text/javascript">
for (var i=0; i<date.length; i++){
document.write("<td>"+date[i]+"</td>");}
</script>

[Code]...

View 5 Replies View Related

A Small Problems With Select And Auto Copy

Jul 23, 2005

I want to capture the text to the clipbroad when i use the mouse left clicking on such text..
( i want to simplify the step of "Highlight Text" > "Mouse Right Click" > "Copy")
Can i use javascript to do this?

I found some hints about this from internet:

View 1 Replies View Related

Java Script To Popup Small Window

Jul 23, 2005

I want to have a 'help' popup on seveal key words on a page.

I don't want to use a button...

But would like to do it like a link... so the text on the page is the link
to the Popup Window.

Can anyone provide me with a simple example of a JavaScript to do this.

View 1 Replies View Related

Small Popup Window For With No Titlebar Or Borders In IE 6+?

Nov 11, 2006

I'm trying this and it has no titlebar, but shows the calendar on a full page.

<a
href="javascript:calendar_window=window.open('cal.aspx?f ormname=aspnetForm.<%=
ChargeFormView.FindControl("StartDate_date").ClientID
%>','calendar_window','width=180,height=130,left=500 ,top=300,titlebar=no,fullscreen=yes');calendar_win dow.focus()">

If I remove fullscreen=yes, I get a nice small window but with a titlebar.

View 4 Replies View Related

JQuery :: Small White Rectangle After Last Slideshow Img?

May 27, 2011

In slideshow running on xp_pro/ie8, after the last slide is displayed, a small white rectangle (approx w:60px h:20px) at the top left positionwhere the1st slide is about to re-appear. The 1st slide then displays correctly, as doall the slides, but I can't keep the rectangle from showing up.

[Code]...

View 1 Replies View Related

Small Doubt Regarding Control Focus Function

Aug 14, 2009

I am using "document.getElementById('dfDataBase').focus();" this function to put focus in the particulate text field control.The cursor is showing in the control, but i am not able to type any data, after clicking in the control then only i am able to type the data.

View 1 Replies View Related

Use The Slimbox To Create A Small Lightbox (such As 5x5 Pixels)?

Sep 10, 2009

how can I use the slimbox [URL] to create a really small lightbox (such as 5x5 pixels), instead of the usual large lightbox?

View 1 Replies View Related

Small Bookmarklets That Make Testing Easier.

Feb 15, 2004

These are a couple little bookmarklets that make testing your pages easier.
This is for adjusting resolution.

<script>
javascript:external.AddFavorite('javascript:void(m=window.open("","m","height=30,width=150"));m.focus();m.document.write('<form><select onchange="opener.eval(this[this.selectedIndex].value)"><option value=""><option value="self.resizeTo(640,480)">640x480<option value="self.resizeTo(800,600)">800x600<option value="self.resizeTo(1024,768)">1024x768</select></form>')','Resize')
</script>

This is for running selected code. You select the code then open the bookmark. (I used it testing this post.)

<script>
javascript:window.external.AddFavorite('javascript:void(window.open("javascript:document.write(opener.document.selection.createRange().text);document.close()"))','Run Code Selected')
</script>

Turn borders on to see table layout.

<script>
javascript:window.external.AddFavorite('javascript:void(t=document.getElementsByTagName("table"));for(i=0;i<t.length;i++){void(t[i].border="1")}','Borders On')
</script>


I use them regularly hope they're usefull to you.

View 8 Replies View Related

Create A Small Function To Expand A Textarea?

Nov 5, 2009

I'm trying to create a small function to expand a textarea when they hit a certain amount of characters.

My textarea is at a certain width and it takes 39 characters to hit the end. At 39 characters I would like the textarea to expand an additional row.

This is what I created:

Code JavaScript:
function boxGrow(control) {
var len = control.value.length;
if (len > 39) {

[Code]....

The problem is that after I hit 39 it keeps expanding by 1 row every extra character even though I set "len" back to zero.

View 3 Replies View Related

Video Appears Very Small In IE8 / Make It Normal?

Jul 15, 2011

We are using FlowPlayer to display a video on our website page here. However the video appears very small in IE8 (like a thumbnail) and I cannot seem to work it out!

View 2 Replies View Related

Click And Place A Small Cross On Screen

Apr 14, 2006

I'm sure I've seen this somewhere before, but can't find it via google. Or I'm using the wrong search words.

Does anyone know of a script where a small cross, or any other small image, can be placed on the screen where the user clicked the mouse?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved