Jump to content

...678

Members
  • Content Count

    54
  • Joined

  • Last visited

Posts posted by ...678

  1. Oki want it to redirect when you click itit wont do iti thought the code was either

    <form action="submitted.html"><input type="button" value="Submit"</form>

    or

    <input type="button" value="Submit" action="submitted.html"></form>

    Please help

  2. There is a small change in the Javascript part and commented the <div> in HTML.....
    <html><head>	<title></title>	<script>			//clickable item ids		var items = ["item0"];		// EDIT: Modify this to add/remove menu		//function to open and close items		function toggle()		{			//get item			var item = this.parentNode;	//note: this = anchor from attachEvents			//get subitem			var subitem = document.getElementById(item.id + "sub");			//toggle subitem			if(subitem.style.display == "none") //closed				//open it				subitem.style.display = "block";			else //open				//close it				subitem.style.display = "none";						//prevent anchor from following href			return false;		}		//function to attach events		function attachEvents()		{			for(i=0;i<items.length;i++)			{				//get next item				var item = document.getElementById(items[i]);				//get item anchor				var anchor = item.childNodes[0];				//attach onclick event				anchor.onclick = toggle;			}		}				//initial setup		function init()		{			//hide all sub items			for(i=0;i<items.length;i++)			{				//get next item				var item = document.getElementById(items[i]);				//get subitem				var subitem = document.getElementById(item.id + "sub");				//hide subitem				subitem.style.display = "none";				//indent subitem				subitem.style.paddingLeft = "10px"; 			}		}		</script></head><body>	<div id="menu">	   <div id="item0"><a href="#">Item 0</a></div>		<div id="item0sub">			<div id="item00"><a href="#">Item 0.0</a></div>			<div id="item01"><a href="#">Item 0.1</a></div>			<div id="item02"><a href="#">Item 0.2</a></div>		</div>		<!-- <div id="item1"><a href="#">Item 1</a></div>		<div id="item1sub">			<div id="item10"><a href="#">Item 1.0</a></div>			<div id="item11"><a href="#">Item 1.1</a></div>			<div id="item12"><a href="#">Item 1.2</a></div>		</div>-->	</div>		<script>		init();		attachEvents();	</script></body></html>

    ok thanks
  3. try this
    <html><head>	<title></title>	<script>			//clickable item ids		var items = ["item0","item1"];				//function to open and close items		function toggle()		{			//get item			var item = this.parentNode;	//note: this = anchor from attachEvents			//get subitem			var subitem = document.getElementById(item.id + "sub");			//toggle subitem			if(subitem.style.display == "none") //closed				//open it				subitem.style.display = "block";			else //open				//close it				subitem.style.display = "none";						//prevent anchor from following href			return false;		}				//function to attach events		function attachEvents()		{			for(i=0;i<items.length;i++)			{				//get next item				var item = document.getElementById(items[i]);				//get item anchor				var anchor = item.childNodes[0];				//attach onclick event				anchor.onclick = toggle;			}		}				//initial setup		function init()		{			//hide all sub items			for(i=0;i<items.length;i++)			{				//get next item				var item = document.getElementById(items[i]);				//get subitem				var subitem = document.getElementById(item.id + "sub");				//hide subitem				subitem.style.display = "none";				//indent subitem				subitem.style.paddingLeft = "10px"; 			}		}		</script></head><body>	<div id="menu">		<div id="item0"><a href="#">Item 0</a></div>		<div id="item0sub">			<div id="item00"><a href="#">Item 0.0</a></div>			<div id="item01"><a href="#">Item 0.1</a></div>			<div id="item02"><a href="#">Item 0.2</a></div>		</div>		<div id="item1"><a href="#">Item 1</a></div>		<div id="item1sub">			<div id="item10"><a href="#">Item 1.0</a></div>			<div id="item11"><a href="#">Item 1.1</a></div>			<div id="item12"><a href="#">Item 1.2</a></div>		</div>	</div>		<script>		init();		attachEvents();	</script></body></html>

    thanks for that that worked well just 1 thingi only need oneso how do i remove Item1 and just leave Item 0
  4. I want an expanding menu so when you click the main link more links are under it if you know what i mean...Like thisLink--- Hidden Link--- Hidden LinkAnd the hidden links appear when you click the linkId like it to be in JavaScript if possible as i am not familiar with CSS.I have googled it but they dont seem to work

  5. If you need a prompt to come up when the page loads and ask for password and redirect....
    <html><HEAD><script language="JavaScript">var password;var pass1="cool";password=prompt('Please enter your password to view this page!',' ');if (password==pass1) {  alert('Password Correct! Click OK to enter!');  window.location.href="correctpage.htm"}else{ window.location="errorpage.htm";}</SCRIPT></HEAD>	<body>	</body></html>

    THANK YOU!THATS EXACTLY WHAT I WANTED!!!!!!!
  6. I wanted to password protect a few of my pages too, and although everyone told me it's better to do it with php, I did it with javascript. It's secure enough for me considering the info behind the password protection script isn't sensitive stuff:Here's the javascript code:
    function protect(form) { if (document.passform.password.value == "password here") {  alert("Password correct, forwarding...");  document.location.href="members.html"; } else {  alert("Password Incorrect"); }

    The document.passform.password.value would be the <input type="text"> field on the form (in this case the form is named "passform")Here's the form:

    <form name="passform"> Password: <input type="password" name="password" /> <BR> <input type="submit" value="Submit" onClick="protect(form)"></form>

    So that's it. Useful if you're not protecting any sensitive stuff (credit card details and such).

    okbut where do i put the
    function protect(form) {if (document.passform.password.value == "password here") {  alert("Password correct, forwarding...");  document.location.href="members.html";} else {  alert("Password Incorrect");}

    Im not really sure what im doing.

  7. Ok..Im not sureso..If i have a form that looks like this :

    <form name="input" action="logintest2.htm" method="get"><br>Password<input type="password" name="LastName" value="" size="20"><br><input type="submit" value="Submit">

    How do i make it so there is a set password and if they get it right they go to one pageif they get it wrong they go to another?

  8. You would have to use either a Browser Scripting language (JavaScript etc) or a Server Scripting Language (PHP,ASP(.NET),ColdFusion etc). Then check if the user has a cookie set that would allow them to view the page. If they do, show the page, and if not, don't show the page.
    how do i make that cookie?
  9. Is there a code that makes a page password protectedSo like you go on the page and it comes up with a prompt box saying enter password. Then if its right it redirects to the page selected and if its wrong it redirects to a page with Wrong PasswordIf there is please tell me

  10. A much simpler method would be to use the target attribute in your links and a name attribute in the iframe:
    <iframe name="MyFrame" src="default.asp"></iframe><ul><li><a href="http://www.w3schools.com/" target="MyFrame">W3 Schools</a></li><li><a href="http://www.google.com/" target="MyFrame">Google</a></li></ul>

    Thanks for thatit works :)
  11. Well you could use JavaScript.
    <script type="text/javascript">function changeFrame(){ document.getElementById('iframe1').src="NEW LOCATION"}</script><a href="java script:changeFrame()">The link</a><iframe src="SOME URL"id="iframe1"></iframe>

    With that code, where do i put the link that it changes to?AlsoIll try and explain better.On the site there is the navigation, and the content shows in an iFrame in a different section. So I want to be able to click the link on the navigation and the iFrame changes to the content that that link would showWhat are table designs?If you could post a link that would help alot
×
×
  • Create New...