Simple JavaScript Question

Jan 30, 2007

I am wanting to make a config.js file that holds all the global scope variables. Then I want other files to use these variables in the web page. Is it possible that the get_stores_AJAX.js and the form-validation3.js have access to the variables in the config.js? If not is it even possible to do something like I am suggesting? If it is possible how do you do it? Code:

View 1 Replies


ADVERTISEMENT

Simple Javascript

Jul 23, 2005

I have a form1 with two fields, field1 and field2. I want the contents of field1 to be transferred to field2 onBlur, but with some changes. I want the contents of field1 to have its spaces replaced with Dashes, and all punctuation removed, so this can happen:

FIELD 1 value:
Today's rate is 15%, & the outlook is good.

onBlur should then create a value of:

FIELD 2 value:
todays-rate-is-15-percent-and-the-outlook-is-good

Notice that the "&" was converted to "and", the "%" to "percent". The comma
was deleted and all spaces replaced with Dashes. The second field should
only every contain alphabetic letter, dashes, and numbers.

View 3 Replies View Related

Simple Javascript Search?

Jan 4, 2006

I'm trying to use this script:

<script>
function QuickSearch() {

var name=document.forms[0].name;
var tempdesc=document.forms[0].tempdesc;

if (name.value="780-06") {
tempdesc.value = 'Women`s Princess Cut Vest|882'
}

else if (name.value="RA32R") {
tempdesc.value = 'Womens Rib Hoody with contrast piping|2290'
}

else if (name.value="75007") {
tempdesc.value = 'WOMENS SLEEVELESS POLO|812'
}

else if (name.value="") {
tempdesc.value = ''
}}
</script>

<form>
<input type="text" name="name" value="" onblur='QuickSearch()' />
<input type="text" name="tempdesc" value="" size="45" />
</form>

to do a simple javascript search, I want to be able to enter say "RA32R" in the name box, and have the description come up, my problem is that it seems to just jump to the first value, even when nothing has been entered into the name field.

View 2 Replies View Related

Simple JavaScript Game

May 22, 2007

I just need JavaScript to validate a form, and tell the person if h/she has answered the question correctly. For example; If the question was, what color is the sun? And h/she answered blue, then pressed the submit button. A text box would pop up explaining that h/she has answered incorectly. If h/she answeres yellow. Then on submit would send that person to the next page.

View 2 Replies View Related

Create A Simple Button Using Javascript

Jan 29, 2005

I would like to know whether it is possible to create a simple button using javascript. i know that text fields can be created using Javascript.

View 24 Replies View Related

Simple Javascript Equality / Field Validation

Apr 15, 2007

All I need is a script to check whether a field contains an exact code. For example,

A user goes through a game, collects pieces of the code - In this case random numbers or letters to form a 9 digit code.

The user can then enter this code into the field, hit submit and told whether they've cracked the code or not.

So basically something like, if this field contains "123456789" then go to WellDone.html but if it contains anything else other than this code then go to BadLuck.html ,

any ideas? Code:

View 4 Replies View Related

Looking For A Specific Simple Cross-broswers Vertical Scrolling Javascript

Mar 21, 2006

Does anyone know a simple cross-broswers vertical scrolling javascript
that can call up its scrolling contents off an external html page/file?

View 1 Replies View Related

Simple Replace

Feb 20, 2006

I want to replace all occurences of this ),( in my string with a comma .....

statement=statement.replace("),(",",");

This only does the first. I've been reading about adding "/g", but haven't
got it to work. I've messed about with no luck. Any quick pointers?

View 2 Replies View Related

Simple Ajax

Oct 2, 2006

i look for a simple ajax, for a beignner, able to send a request for a text file and show its content in a <div />.

View 6 Replies View Related

Simple Bookmarklets

Mar 18, 2003

Here's a small collection of bookmarklets for disecting your own (or other people's!) websites. They do things like, show all TABLE elements with a red border, hide non-link images, and so on...

View 23 Replies View Related

Simple Counter

Oct 26, 2005

i need a 5 second counter to start when the page loads. basically the usage is I want people to click a link, and if the page has been loaded for more than 5 seconds, do thisFunction().. if not, do nothing.

so basically

<script type="text/javascript">

window.onload --> start the counter
// when the counter hits 5 seconds, set var done = true;

function thisFunction() {
if (done = true) { proceed with function)
else {do nothing}
}
</script>

...

<a href="linkyPoo.html" onclick="checkCounter">OO oOO, click me!</a>

View 8 Replies View Related

Simple Validation

Jun 13, 2003

I'm trying to write some validation for a field called Propid, in a form called qSearch. Basically if there's nothing in Propid, or it is says "ref no.", I want to alert the user, otherwise, I want the form to submit.

Here's what I have at the moment:

Code:


<script>
function checksearch()
{

if (qSearch.Propid.value!="ref no." )
{
alert ("Select reference number" );
qsearch.Propid.focus();
return;
}
if (qSearch.Propid.length != 0)
{
alert ("Select reference number" );
qSearch.Propid.focus();
return false;
}
}
}

View 6 Replies View Related

Simple Settimer

Aug 11, 2004

PHP Code:

<!--
function submitForm()
{
window.setTimeout(document.email_inner.submit(),5000);
}
//-->

im trying to submit my forum after 5 secounds of viewing the page and i have no knowlege of java wat fo ever but ey told me this is the onlyway to do such a thing ... this i wat i have so far in hte header .... it dose nothing at all

View 5 Replies View Related

Simple Regexp

Apr 18, 2005

im tired of working all day...
please how to delete the value with regexp...
i tried this

bla.replace('value="/.+/"', '');

it wont work...

View 5 Replies View Related

Simple Animations

Apr 14, 2006

Just a few questions about simple animations (that aren't Flash). I've searched around but haven't been able to find anything really concrete about alternatives to JS. Basically in terms of simple animation, is JS the be-all-end-all? What other options are there in terms of simple animated menus (besides Flash & animated GIFs)?

Something like the above Quick Links menu; would something like that be possible in only Javascript? Or would there be an alternative?

View 4 Replies View Related

Simple Countdown

Aug 21, 2002

I'm looking for a javascript that will do a 3 minute countdown and display it on the screen, preferably not in a textbox, but i'm not picky.

Here is how it works. Someone will make a selection from a form. The date/time of that selection is then stored in a database. I want to use the date time stored in the database as my starting time and then countdown 3 minutes. After 3 minutes I would like a message saying Times Up, please make a selection.

View 3 Replies View Related

Simple JS Link

Nov 9, 2002

How do I use JavaScript instead of using this " <a target="_blank" href="http://www.OtherWebsites.com">Other websites</a> " if I want to use a list of JavaScript links?

View 3 Replies View Related

Simple Check If Odd Or Even

Aug 31, 2009

Heres my code:

<html>

View 7 Replies View Related

Simple 0 To 13 Loop ?

Sep 20, 2011

I have a rather simple question. It's been four long years since I last dealt with JS and although I remember the basic concepts behind loops I don't remember how to actually implement them.

This is my current code:

What's bothering me is how redundant it is. I would much rather simplify it into a few lines where i increments by 1 from 0 to 13 in the case of image[i] and cover[i]. Is this possible? And if so, how would I go about articulating it?

View 10 Replies View Related

Simple Mailto Snippet?

Jul 23, 2005

I am building a stand alone html help system (.chm.) So the usual woes with
mailto are not going to be encountered. Likewise I am ensured all my
intended users have Outlook installed. With that said This is what I want
to do.

I have a simple html form with a an radio button option group, a listmenu, a
text box, and a text area. What I would like to do is have a user fill out
this form, and hit a button that sends the results via outlook. The TO, CC,
and subject fields will be hard coded. I want the option from the list menu
on line one, the radio button on line two, the text box on line three and
the multi-line text area starting on line 4.

I haqve searched the web, and groups all day to no avail. Everything I have
tried simply fails. I even tried breaking this down into a simple one text
box one button, with no good results via javascript. I can get it to work ok
without javscript, but instead of new lines they just overwrite each other.

View 3 Replies View Related

Simple Prev/Next Navigation

Jul 23, 2005

I would like to have a navigation menu with prev/next in a top frame
and in the main frame a PDF file.

I think this might be possible with javascript:

- get current file name
- go to next prev in the list of 10 files

View 1 Replies View Related

How To Write A Simple Vertical Nav Bar?

Jul 23, 2005

does anyone know how to write a simple vertical javascript nav bar?

View 3 Replies View Related

Simple Form Validation

Oct 15, 2005

I've been playing with this form validation method for a while and have
tried an array of things but haven't had any luck with a couple items.

1. The validateForm() function doesn't detect when the Min price is
greater than the maximum price.

2. The validateForm() function doesn't call isNumber() on the minBaths,
maxBaths, minBeds, or maxBeds.

3. Despite errors in input and the validateForm() function returning
false, the form is still submitted.

Here's the code:

View 11 Replies View Related

Simple InnerHTML Issue

Jul 20, 2005

I'm trying to dynamically change the contents of a select box by doing the
following...

function myfunc() {
var obj=document.getElementById("objname"); // name of the select box
var str=''
str+='<option>blah</option>'
obj.innerHTML=str;
alert(obj.innerHTML);
}

For reasons I don't understand, the alert gives me 'blah</option>'. Where is
the leading <option> tag?

View 5 Replies View Related

Simple Browser Detect

Jul 20, 2005

I've seen plenty of browser detection scripts but they all seem to be slightly different and don't really fit my needs. I have various places where if the browser is IE I'd like to display [this html code] else [display this]. For example, if a browser is IE I want to use this CSS file
otherwise use a different one and if it's IE make this cell x pixels high else make it y pixels high. I'm sure this is easy ....

View 7 Replies View Related

Can't Get GetElementsByClassName To Work In A Simple Example?

Apr 17, 2011

I can't get GetElementsByClassName to work.Clicking on the first button moves data to a second function that when clicked moves the data to the input field.This codes works when I change getElementsByName('pics')to getElementById('upload').But I need it to work with getElementsByName().

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>[code]....

View 2 Replies View Related







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