5 Replies - 595 Views - Last Post: 13 July 2010 - 01:37 AM

#1 nehab  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 15
  • Joined: 16-May 10

Drop down querry!

Posted 12 July 2010 - 10:05 PM

hi guys
i have stuck in a problem.
i have two links:

"Show 1", "Show 2"

if i click on "Show 1" and appears with "show 1 content" and

if click on "Show 2" and th appears with "show2 content"
Here is the html code
<select name="choice" class="VisStyleGraySmall" id="sizes" >
                                <option value="" id="0" >Size 6</option>
                                <option value="" id="1">Size 8</option>
                                <option value="" id="2"  >Size 10</option>
                                 <option value="" id="3"  >Small</option>
                                  <option value="" id="4"  >Medium</option>
                                   <option value="" id="5"  >Large</option>
                                    <option value="" id="6"  >XLarge</option>
                              </select>



and here i am using code for java scripting


function show1()
{

	

var s0=document.getElementById("0");
	var s1=document.getElementById("1");
	var s2=document.getElementById("2");
	var s3=document.getElementById("3");
	var s4=document.getElementById("4");
	var s5=document.getElementById("5");
	var s6=document.getElementById("6");

	
	s3.style.display= 'block';
	s4.style.display= 'block';
	s5.style.display= 'block';
	s6.style.display= 'block';
	s2.style.display= 'none';
	s1.style.display= 'none';
	s0.style.display= 'none';

function show2()
{
	check(Maled,Femaled);
	
	GFemaled=document.getElementById('mainImg');
	GMailed=document.getElementById('mainImg2');

	GMailed.style.display = 'none';
	GFemaled.style.display= 'block';
	
	var s0=document.getElementById("0");
	var s1=document.getElementById("1");
	var s2=document.getElementById("2");
	var s3=document.getElementById("3");
	var s4=document.getElementById("4");
	var s5=document.getElementById("5");
	var s6=document.getElementById("6");

	
	s3.style.display= 'none';
	s4.style.display= 'none';
	s5.style.display= 'none';
	s6.style.display= 'none';
	s2.style.display= 'block';
	s1.style.display= 'block';
	s0.style.display= 'block';

	



please help me for this...really need it urgent
Thanks and Regards
N

Is This A Good Question/Topic? 0
  • +

Replies To: Drop down querry!

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3489
  • View blog
  • Posts: 10,057
  • Joined: 08-June 10

Re: Drop down querry!

Posted 12 July 2010 - 11:03 PM

note: IDs must not start with a digit, allowed start characters are letters and the underscore, anything else is browser courtesy.
Was This Post Helpful? 0
  • +
  • -

#3 nehab  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 15
  • Joined: 16-May 10

Re: Drop down querry!

Posted 12 July 2010 - 11:40 PM

View PostDormilich, on 12 July 2010 - 10:03 PM, said:

note: IDs must not start with a digit, allowed start characters are letters and the underscore, anything else is browser courtesy.


My coding is working but the problm which i am facing is..on the load of page each size is showing in the drop box..but by default i want sizes from size 6 to size 10..so i want 3 sizes on the load of the page instead of all 7 sizes.
when i am clicking on show 1..there option are showing size small to size Xlarge and vice versa...just i want on the first run of the page 3 sizes comes..how will i di this..??
help me...pulling my hairs since morning...:(
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3489
  • View blog
  • Posts: 10,057
  • Joined: 08-June 10

Re: Drop down querry!

Posted 13 July 2010 - 12:00 AM

you need to call either of the functions (couldn’t figure out which) on load of the page.

modern browsers allow you to do:
window.addEventListener("DOMContentLoaded", myfunction, true);

older browsers (like IE) need something like
window.onload = myfunction;

Was This Post Helpful? 0
  • +
  • -

#5 nehab  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 15
  • Joined: 16-May 10

Re: Drop down querry!

Posted 13 July 2010 - 01:35 AM

hi thanks for the replies...
ya actually i was forgetting to call on initialize.its done...but one new problm occurs..previuosly i was just browing in firefox..now my tabs is working in firefox corectly with just minnor problm..but one big error is coming when i browse my page in IE and safari...its not changing the dropdown options on the click of any button and not even ont he page load...its showing all the 7 dropdown option on any click...not getting the problm...may b some syntex error..i realy dont know...
plz figure out if possible

Thanks and regards
N
Was This Post Helpful? 0
  • +
  • -

#6 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3489
  • View blog
  • Posts: 10,057
  • Joined: 08-June 10

Re: Drop down querry!

Posted 13 July 2010 - 01:37 AM

I need a live page to tell you anything that is browser specific, as I am only able to predict (to some extend) script behaviour for the ideal JS implementation.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1