Will not show or hide (source provided) UPDATE firebug error posted

Not even my error message to tell me if wrong will go off

Page 1 of 1

3 Replies - 1146 Views - Last Post: 31 August 2009 - 10:39 AM

#1 coaster3000  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 1
  • View blog
  • Posts: 99
  • Joined: 28-August 08

Will not show or hide (source provided) UPDATE firebug error posted

Posted 26 August 2009 - 01:07 PM

			<meta http-equiv="Content-Script-Type" content="text/Javascript" />
script>
<!--
function Show(divId){
document.getElementById(divId).style.visibility ='visible';
}
function Hide(divId){
document.getElementById(divId).style.visibility ='hidden';
}
function Showhide(divId){
if (document.getElementById(divId).style.visibility =='hidden') {
Show(divId)
}
else if (document.getElementById(divId).style.visiblilty =='visible') {
Hide(divId)
}
else {
alert('An Error Occured during show/hide command please notify creator immediatly about this error')
}
}

//-->
</script>
 


Skipping to the part where it calls to
				<form>

				<input type="button" value="Show/hide"  onclick="Showhide('hs');" />
				</form>
				<div id="hs">
					<img  src="images/previews/1.bmp" style="width:250px;height;250px;border:3px ridge black;" >
					<img  src="images/previews/2.bmp" style="width:250px;height;250px;border:3px ridge black;" >
					<img  src="images/previews/3.bmp" style="width:250px;height;250px;border:3px ridge black;" >
					<br>
					<img  src="images/previews/4.bmp" style="width:250px;height;250px;border:3px ridge black;" >
					<img  src="images/previews/5.bmp" style="width:250px;height;250px;border:3px rnamege black;" >
					<img  src="images/previews/6.bmp" style="width:250px;height;250px;border:3px ridge black;" >



It will not show or hide now. Can you help. I decided to use the regular show hide code and make a single button out of it. Thanks. Not even my error i put will go off Thanks

EDIT: here is the firebug error.

wait i fixed it but... Now its doing nuthing but that error message i put it as if it does not run well :S also i updated the source because i fixed some of the errors myself i found because of firebug. firebug helped with most but now i cant find it

This post has been edited by coaster3000: 26 August 2009 - 01:30 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Will not show or hide (source provided) UPDATE firebug error posted

#2 Wimpy  Icon User is offline

  • R.I.P. ( Really Intelligent Person, right? )
  • member icon

Reputation: 159
  • View blog
  • Posts: 1,038
  • Joined: 02-May 09

Re: Will not show or hide (source provided) UPDATE firebug error posted

Posted 26 August 2009 - 01:34 PM

You have one missing ")", one "}" and a spelling mistake in there! Replace your javascript with this:
function Show(divId)
{
	document.getElementById(divId).style.visibility ='visible';
}

function Hide(divId)
{
	document.getElementById(divId).style.visibility ='hidden';
}

function Showhide(divId)
{
	if (document.getElementById(divId).style.visibility =='hidden')
	{
		Show(divId)
	}
	else if (document.getElementById(divId).style.visibility =='visible')
	{
		Hide(divId)
	}
	else
	{
		alert('An Error Occured during show/hide command please notify creator immediatly about this error')
	}
}
and it should work! if you get your error you might have to add style="visibility: visible;" on the div you want to affect! Hope it helps! :)

EDIT:
A good tip is to always test your javascript in Firefox since Firefox's error console often give you pretty straight forward explanations as to why your code does not work! :)

This post has been edited by Wimpy: 26 August 2009 - 01:36 PM

Was This Post Helpful? 0
  • +
  • -

#3 coaster3000  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 1
  • View blog
  • Posts: 99
  • Joined: 28-August 08

Re: Will not show or hide (source provided) UPDATE firebug error posted

Posted 26 August 2009 - 01:45 PM

View PostWimpy, on 26 Aug, 2009 - 03:34 PM, said:

You have one missing ")", one "}" and a spelling mistake in there! Replace your javascript with this:
function Show(divId)
{
	document.getElementById(divId).style.visibility ='visible';
}

function Hide(divId)
{
	document.getElementById(divId).style.visibility ='hidden';
}

function Showhide(divId)
{
	if (document.getElementById(divId).style.visibility =='hidden')
	{
		Show(divId)
	}
	else if (document.getElementById(divId).style.visibility =='visible')
	{
		Hide(divId)
	}
	else
	{
		alert('An Error Occured during show/hide command please notify creator immediatly about this error')
	}
}
and it should work! if you get your error you might have to add style="visibility: visible;" on the div you want to affect! Hope it helps! :)

EDIT:
A good tip is to always test your javascript in Firefox since Firefox's error console often give you pretty straight forward explanations as to why your code does not work! :)

That code was much helpful but now there is the error message i put in there just in case it did not work properly

An Error Occured during show/hide command please notify creator immediatly about this error

the pop up keeps on poping up any way to fix that if command to collect the data needed from the item :S it wont collect properly. it keeps on saying it does not exist. wait.. let me try one thing and i will edit this after that if this worked edit its fixed now but i think i do not need that error message anymore i will use the else statement to make it the show command thanks for all the help guys

This post has been edited by coaster3000: 26 August 2009 - 01:48 PM

Was This Post Helpful? 0
  • +
  • -

#4 Wimpy  Icon User is offline

  • R.I.P. ( Really Intelligent Person, right? )
  • member icon

Reputation: 159
  • View blog
  • Posts: 1,038
  • Joined: 02-May 09

Re: Will not show or hide (source provided) UPDATE firebug error posted

Posted 31 August 2009 - 10:39 AM

View Postcoaster3000, on 26 Aug, 2009 - 10:45 PM, said:

That code was much helpful but now there is the error message i put in there just in case it did not work properly

An Error Occured during show/hide command please notify creator immediatly about this error

Do you set the style="visibility: hidden/visible;"-attribute on the element? Otherwise your javascript can't find it... :)

View Postcoaster3000, on 26 Aug, 2009 - 10:45 PM, said:

...thanks for all the help guys

Last time I checked I was only one person but you are very much welcome, happy to help! :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1