Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 2nd, 2005, 11:14 PM
Friend of Wrox
Points: 1,107, Level: 13
Points: 1,107, Level: 13 Points: 1,107, Level: 13 Points: 1,107, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: , , .
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default how to duplicate a javascript

How do you duplicate this in one page?

Code:
<script><!--

arChapters = new Array(50,40,27,36,34,24,21,4,31,24,22,25,29,36,10,  13,10,42,150,31,12,8,66,52,5,48,12,14,3,9,1,4,7,3,  3,3,2,14,4,28,16,24,21,28,16,16,13,6,6,4,4,5,3,6,4  ,3,1,13,5,5,3,5,1,1,1,22); // # of chapters in books


function loadCombo(cbo, idx) {
 el = null;
 ar = null;
 txt = "";
 
 if(cbo == 1) {
   el = document.f.number;
   ar = arChapters;
   txt = "";
 }
 
 while (el.options.length > 0) {
   for(i=0;i<el.options.length;i++) {el.options[i] = null;}
 }
 
 el.options[el.options.length] = new Option(txt + 1);
 for(i=1;i<=ar[idx-1];i++) {
   el.options[el.options.length] = new Option(txt + i);
 }
 
}
// -->
</script>


Learning of our true origins.

I feel sorry:

http://www.infowars.com/articles/wor...eknowledge.htm

Foreknowledge of A Natural Disaster
Washington was aware that a deadly Tidal Wave was building up in the Indian Ocean
  #2 (permalink)  
Old March 3rd, 2005, 04:50 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Can you clarify? What do you mean by duplicate?

--

Joe (Microsoft MVP - XML)
  #3 (permalink)  
Old March 3rd, 2005, 02:03 PM
Friend of Wrox
Points: 1,107, Level: 13
Points: 1,107, Level: 13 Points: 1,107, Level: 13 Points: 1,107, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: , , .
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

The code works but what i'm doing is 2 dropdowns to select a book and then select a chapter. I press search and the text shows in the iFrame. So far it works.

But when I wanted to compare 2 texts I thought I should include 2 of the codes in 1 page which each had the javascript above (if there was no javascript it would've worked). I think there is a confusion in the Javascript and the name or id of dropdown.

Is it possible to either make 2 javascripts or to join them?

DO you want to see them with the dropdowns?

Learning of our true origins.

I feel sorry:

http://www.infowars.com/articles/wor...eknowledge.htm

Foreknowledge of A Natural Disaster
Washington was aware that a deadly Tidal Wave was building up in the Indian Ocean


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validate duplicate Entries using javascript sams ASP.NET 1.0 and 1.1 Professional 3 July 2nd, 2007 03:31 AM
duplicate emails flchen Classic ASP Components 2 February 14th, 2007 09:02 AM
duplicate problem dextermagnific XSLT 1 August 7th, 2006 11:55 AM
Duplicate Records mrookey Dreamweaver (all versions) 1 April 15th, 2005 11:23 AM
Duplicate E-Mails SerranoG Forum and Wrox.com Feedback 3 March 30th, 2004 03:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.