473,320 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Hiding selected divs with by keyword

If I had 4 divs, box1, box2, box3 and box4, and I wanted a script to make certain combinations of them visable controlled by a number sequence in a second div called: "1to4".

The script should be conditional: when the contents of div "1to4" are "124", <div box1, box2, and box4 automatically show. If the contents of "1to4" are "1234", then all 4 divs should be displayed. The contents of "1to4" start as a custom tag called {{LAYOUT}}, which is filled in automatically by my server for each inventory item.
Here is the existing code.

http://www.jarrodprice.myhomeserver.com/webpage.html


The solution I had used the following script:

script language="javascript">
Expand|Select|Wrap|Line Numbers
  1.                function showHide(){
  2.                     var pDivArr=document.getElementById('1to4').innerHTML.split("");
  3.                     var fDiv="box";
  4.                     for(i=0;i<pDivArr.length;i++){
  5.                          var divN=fDiv+pDivArr[i];
  6.                          if(document.getElementById(divN)){
  7.                               document.getElementById(divN).style.display="block";
  8.                          }
  9.                     }
  10.                }
  11.  
</script>

This worked perfectly, until I tried to post to ebay. Ebay prevents this particular script from working.

I am hoping to find a variation on the same script that ebay will allow.
Nov 14 '06 #1
1 1314
acoder
16,027 Expert Mod 8TB
Perhaps ebay doesn't allow any script.

The code posted is OK, except that IDs should not start with a number, so "1to4" should be replaced with, e.g. "OneTo4".
May 29 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Chris Hughes | last post by:
I have a routine that creates a page with 2 sets of tables with divs around them. Each div tag has a name. The first set of tags are as follows div id="T123" STYLE="display: none;"> div...
39
by: WindAndWaves | last post by:
Hi Gurus I have a page, which looks a bit like this: .... <body> <div ID=id1>................</DIV> <div ID=gsd>................</DIV> <div ID=ewd>................</DIV> <div...
8
by: Jeroen Smits | last post by:
To Microsoft or other people who are interested, I have a feature request: I would really like to have an option to 'hide' a property or method from an inherited class. For example when I create...
1
by: roland-d | last post by:
Hello all, Toggling divs is a popular subject and I have found plenty of information and was able to make it work. There is only 1 thing I am still stuck with for quite some time. I have a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.