JavaScript - Can Javascript Hide Text
I'm making a multiple choice test,
it all must be on the same page but the user must not be able to see the next question until they finish the first and click continue. Is this possible in Javascript by manipulating form object or something else? Thanks for any suggestions. Similar TutorialsI am not sure how to word this but I want an effect similar to this:
http://www.sean.co.uk/a/webdesign/ja...disappear.shtm
http://www.dynamicdrive.com/dynamici...tchcontent.htm
Only is it possible to have multiple links in a list and have the content (when you click on the link to make the hidden content appear) appear below all the links--instead of right below the link that was clicked on? Because I noticed that the hidden content appears right below the link. It said on the first website that you could "Use CSS to change the position of the material to be displayed or hidden. You could use that to overlay instructions on the whole screen in a pop-up window, for example." Is that the same thing as what I am wanting to do? So how would I go about doing that? Anything similar to that would be great. i am new at all of this so sorry for any confusion. Also thanks in advance.. Code: <html> <title> random!!</title> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery.min.js"></script> </head> <body> <div class="one" style="cursor: pointer;"> type1<br/><br/></div><div class="two" style="cursor: pointer;">type2<br/><br/></div><div class="three" style="cursor: pointer;">type3<br/><br/></div> <div class="oneone">atrdjgkhgfyfygfykfyfkygfvkgvkhgv</div><div class="twotwo">hgfihygohgohsgoihgolhgshgoshdgchchj</div><div class="threethree">siucgdiuhsbcohbscjbsidjcksjdnck</div> <script type="text/javascript"> $(document).ready(function() { $('div.twotwo').hide(); $('div.threethree').hide(); $('div.one').toggle(function() { $('div.twotwo').hide(); $('div.threethree').hide(); $('div.oneone').fadeIn('slow'); }, function() { return false; }); $('div.two').toggle(function() { $('div.oneone').hide(); $('div.threethree').hide(); $('div.twotwo').fadeIn('slow'); }, function() { return false; }); $('div.three').toggle(function() { $('div.twotwo').hide(); $('div.oneone').hide(); $('div.threethree').fadeIn('slow'); }, function() { return false; }); }); </script> </body> </html> The following code works perfectly when clicked once in each of the sub divisions(type1, type2, type3) for hide/show. But from the next time onwards we will have to click twice to initiate the hide/show. Can anyone suggest changes to make the code work as desired??.. P.S: sorry if i have made any stupid mistake.. i am quite new to this!! Hi need a bit of expert help with some thing i am trying to achive but cant find any code on line. all i want to do is to have a list of items in a div box on the left of the screen and when i click on one of them it shows a div box with the related text on the right side of screen in the second div box and hides any previouse showing divs on the right. Thanks Ralph Hey everybody, I have a script that hide a div like in a menu, bur the text of the div dont hide.... Code: <script> function aumenta(id) { target = document.getElementById(id); setInterval(function(){ new_size = target.style.height; new_size = new_size.split("px", 1); new_size -= 10; new_size = new_size + "px"; target.style.height = new_size; //target.style.width = new_size; },1); } </script> </head> <body > <div id="da" style="width:300px; height: 300px; background-color: #0066CC;" onmouseover="aumenta('da')">dDffffffffffffffffffdsdsd</div> </body> What part I have to fix in my code, for do what I want? Thanks! Hi Im looking for a way to show hide text box on select option change PHP Code: <select name="letter_type" id="lt"> <option value="Registered">Registered</option> <option selected="selected" value="Unregistered">Unregistered</option></select> <input name="textfield7" id="regty" type="text" accesskey="1" tabindex="1" size="20" /> i wana show that text box if user select "Registered" from select option. any help would be great sorry for language errors. Thanks Apologies if this question has been asked a million times. I am fairly new to this game, have got my head around html & css and now it's time to add a little interactivity... BUT i've hit my first brick wall... I am setting up a (big) panel of text which i wish to present in a more reasonable fashion by hiding the content and only showing the headers. Got the Hide:Show function working ok as shown below, but I am stuck on my next requirement... Basically The hidden text will show and hide when told by clicking on the relevant header - but i wish to hide the text in a visible area when clicking on a new header. I have: Header1 (on click) | bodycopy - visible Header2 | bodycopy - hidden leading to: Header1 | bodycopy - visible Header2 (on click) | bodycopy - visible But i'm after: Header1 (on click) | bodycopy - visible Header2 | bodycopy - hidden leading to: Header1 | bodycopy - hidden Header2 (on click) | bodycopy - visible Here is the code i'm using: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> <script type="text/javascript"> <!-- function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'block') e.style.display = 'none'; else e.style.display = 'block'; } //--> </script> <style type="text/css"> <!-- #slide_text1 { font-family: Arial, Helvetica, sans-serif; font-size: 0.8em; line-height: 1.4em; color: #000; margin-bottom: 15px; } #slide_text2 { font-family: Arial, Helvetica, sans-serif; font-size: 0.8em; line-height: 1.4em; color: #000; margin-bottom: 15px; } .h3_toggle { font-family: Arial, Helvetica, sans-serif; font-size: 1em; line-height: 1.2em; color: #999; text-decoration: none;} .h3_toggle:hover { font-family: Arial, Helvetica, sans-serif; font-size: 1em; line-height: 1.2em; color: #333; text-decoration: none; cursor: crosshair; } --> </style> </head> <body> <h3><a class="h3_toggle" onclick="toggle_visibility('slide_text1');">First heading </a> </h3> <div style="display:none;"" id="slide_text1">Body copy content to be hidden lives in this area</div> <h3><a class="h3_toggle" onclick="toggle_visibility('slide_text2');">Second heading</a> </h3> <div style="display:none;"" id="slide_text2">Body copy content to be hidden lives in this area</div> </body> </html> Any help from you all is very much welcome (or if this has been answer before - a nudge in the direction of the answer please) Thanx, Ozwaldo. I can I take a code like this: Code: <script language="javascript"> function toggle() { var ele = document.getElementById("toggleText"); var text = document.getElementById("displayText"); if(ele.style.display == "block") { ele.style.display = "none"; text.innerHTML = "show"; } else { ele.style.display = "block"; text.innerHTML = "hide"; } } </script> <a href="javascript:toggle();" id="displayText">Show/Hide</a> <div id="toggleText" style="display: none;">This is Hidden Text</div> But make it so you see "Show" before you click, then change the text to "Hide" once you click the link? Hi, I know very little about javascript, but it seems like what I need to do is simple, so I'm hoping someone here could help. In my online store.... I have a <div> called "prodprice" which houses a dynamically loaded price {tag_saleprice}. When the price is $0.00, I want the <div> to be hidden. When the price is anything other than $0.00, I want it to be visible. I have no idea how to code it, but it seems like the general logic would be something like this: <div id="prodprice" style="display:none">{tag_saleprice}</div> document.getElementById('prodprice') If prodprice="$0.00" .style.display = "block"; Am I totally off base? I just have no idea what to do and I have an impatient client! Thank you so much. I do not understand javascript at all. For about eight years I've had a UDM javascript menu on each of about 200 pages. It consists of a bunch of files that live in the top of my website and are called to each page by four lines of script. I have had only to edit appearance and links in one file. Instructions were to leave the others alone. The present version of the UDM menu is not free, as the old one was, and if I did buy it I'm not at all sure I'd be able to cope with it. Unless the names of the new files matched those of the old ones, I'd have to go in and edit each page individually. My problem is that IE9 doesn't display the menu, but does display its background, so there's a big beige block on the top left of every page. It looks bad. Would I be able to add to one of the files something like a conditional comment such as "If IE9 display none"? I would be truly grateful for any ideas that would help me fix this. My site is http://fay.iniminimo.com/ Thank you so much for your interest. Fay hey i need help of all u guys.Actually the problem is that when i am loading this html page i just want the sign in page to appear and on click of cancel button i want a page to appear and on click of login button i get log in page..but the problem is that whenever i load my html page i get the sign in page and the page that is present on the cancel page..i tried showing and hiding and tried but i dnt know what more to do...please help me out.. Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> </title> <link rel="stylesheet" type="text/css" href="styling.css"/> <script type="text/javascript" src="jquery-1.7.1.js"></script> <script type="text/javascript"> window.onload = function() { document.getElementById('first_div').style.display = 'none';} function toggle(link, div1id, div2id) { var div1 = document.getElementById(div1id); var div2 = document.getElementById(div2id); if (div1.style.display == 'none') { $('#third_div').hide(); div1.style.display = 'block'; div2.style.display = 'none'; link.innerHTML = 'Login'; } else { $('#third_div').hide(); div1.style.display = 'none'; div2.style.display = 'block'; link.innerHTML = 'signin'; } } function toggleImg(divId) { $('#first_div').hide(); $('#second_div').hide(); $('#third_div').show(); } </script> </head> <body> <div id="first_div" class="container"> <label for="username"> <span>Username:*</span> <input type="text" class="text" id="user" placeholder="Username" maxlength="24" onFocus="this.style.borderColor='#B0E0E6';" onBlur="this.style.borderColor='#D3D3D3';"/> </label> <label for="password"> <span>Password:*</span> <input type="password" class="text" id="pass" placeholder="Password" maxlength="24" onFocus="this.style.borderColor='#B0E0E6';" onBlur="this.style.borderColor='#D3D3D3';"/> </label> <label> <input type="checkbox" name="remember" id="remember" class="checkbox" value="1" tabindex="3" /> Remember Me? </label> <label> <input type="submit" name="submit" class="button1" id="doLogin" value="Sign in" /> </label> </div> <div id="second_div" class="container1"> <label for="username"> <span> Username:*</span> <input type="text" id="username" class="text" placeholder="Username" maxlength="24" onFocus="this.style.borderColor='#B0E0E6';" onBlur="this.style.borderColor='#D3D3D3';"/> </label> <label for="password"> <span>Password:*</span> <input type="password" id="password" class="text" placeholder="Password" maxlength="24" onFocus="this.style.borderColor='#B0E0E6';" onBlur="this.style.borderColor='#D3D3D3';"/> </label> <label for="repass"> <span>Re-Password:* </span><input type="password" id="repass" class="text" placeholder="Re-password" maxlength="24" onFocus="this.style.borderColor='#B0E0E6';" onBlur="this.style.borderColor='#D3D3D3';"/> </label> <label for="email_id"> <span>Email-Id:</span><input type="text" id="email_id" class="text" placeholder="Verify email-id" maxlength="24" onFocus="this.style.borderColor='#B0E0E6';" onBlur="this.style.borderColor='#D3D3D3';"/> </label> <label><input type="submit" name="submit" class="button1" value="Submit" /></label> </div> <div id="third_div" class="image"> <img src="https://gs1.wac.edgecastcdn.net/8019B6/data.tumblr.com/tumblr_m2rdcqQLrA1qcb6kno1_500.jpg" /> </div> <div class="header"> <button class="button_cancel" onclick="toggleImg('third_div');">Cancel</button> <button class="button_sign" id="sign" onclick="toggle(this,'first_div', 'second_div'); return false;">Sign_in</button> </div> </body> </html> I wanted it according to this website https://www.tumblr.com Hello, I have a shopping cart that calculates shipping on products based on weight. What I'm wanting to do is use Javascript to scan the contents of the visitors shopping cart for a particular word, as well as scan the quantity of the product in the cart. The condition: If the product name = some string I want to compare AND if the quantity < some number I want to compare. If these two conditions are met, I wan't to hide a shipping option called 'Free Shipping' once the user clicks the Estimate Shipping & Tax button. Here is a link to the websites cart.php page: All Commercial Furniture.com - Shopping Cart The platform we use is a little limited, so they don't give us access to their PHP files. Having to find a workaround for right now. Please let me know if you need any info. Any point in the right direction would be great. Thanks Hi to all, i have a javascript on my websute that i want to hide from all users , i want put it on a database mysql and recall it, in order to hide the code, how I can make? you have some idea? please help me. Hey, I wonder how I'm going to do when it comes to the function of "show/hide" with JavaScript. My question is: I'm working on a web form. The following question is on the form: "Was ITK used?", and you're supposed to be able to pick "Yes" or "No" (by radio buttons), and this I've already fixed with no issues. But what I CAN'T do, for some strange reason, is that when you've clicked "Yes" on that question, it should appear another question: "Does customer have ITK in their network?", and when that comes up you're supposed to choose between "Yes"/"No" with radio buttons there as well. BUT if you click "No" on the first question (Was ITK used?), the other question (Does customer have ITK in their network?) shouldn't appear... Do you understand what I mean? How do I do this? Thanks in advance! New assignment. This is the code i have below already supplied now. not exactly correct yet but want to just get something to work from i need to insert an embedded script element in head section of document, purpose os to hide htmlcode and csscode frames to provide more screen space to hide 2 frames i am to change value of rows attribute in demo frameset to "100,1,*" id of the frameset object is demo Code: <title>Web Design Demo Control Buttons</title> <link href="title.css" rel="stylesheet" type="text/css" /> <script src="demo.htm" type="text/javascript"></script> <script type="text/javascript"> function showPreview(id,x,y) { object=document.getElementById(id); object.style.visibility="hidden"; top.FrameName.rows = "100,1,*"; } </script> just for your reference here is the demo part Code: <html> <head> <!-- New Perspectives on JavaScript Tutorial 6 Case Problem 3 Web Design Demo Filename: demo.htm Supporting files: css.htm, html.htm, title.htm --> <title>HTML Demo</title> </head> <frameset rows="100,210,*" id="demo" name="demo"> <frame name="title" id="title" src="title.htm" scrolling="no" /> <frameset cols="*,*"> <frame name="code1" id="code1" src="html.htm" /> <frame name="code2" id="code2" src="css.htm" /> </frameset> <frame name="output" id="output" /> </frameset> </html> how does this look so far just remember the top code is what i am working on what should i change and add? suggestions anyone? so basically i have javascript code that i've been trying to write. When "Other" is selected in the form's drop down box, its supposed to show the textarea, otherwise its supposed to stay hidden. I made a seperate HTML page so whomever views this didn't have to scroll through my other javascript code / html / php lol... anyhow here it is Code: <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"> </script> <script type="text/javascript"> function update2(f,s,h) { var first=$('#'+f).val(); var hidden=$('#'+h); if(first=="other") { hidden.css('display','block'); else {hidden.css('display','none');} } </script> </head> <body bgcolor="#002E2F"> <form name="Manager" method="post"> <table border="0" style="background-color:#f4fbee" width="651" height="25" cellpadding="3" cellspacing="3"> <tr> <td width="651"><font face="verdana" size="2">Please tell us how you were referred to RSIC</font></td> </tr> <tr> <td width="651"> <form action=""> <select name="referred" id="referred" onchange="update2('referred','othertextarea','otherp');"> <option value="select" selected="selected">Select...</option> <option value="AttendRSIC">Attended RSIC Event</option> <option value="AttendIndus">Attended Industry Event</option> <option value="RefRSIC">Referred by RSIC Staff / Board</option> <option value="CurrentRSIC">Current RSIC business partner</option> <option value="RefThird">Referred by a third party that does business with RSIC</option> <option value="other">Other</option> </select> </td </tr> <tr> <td width="651"><font face="verdana" size="2">If you selected "Other" on the previous field, please describe below</font></td> </tr> <tr> <td width="651"> <p id="otherp" style="display:none;"> <textarea name="othertextarea" id="othertextarea" rows="5" cols="78"> </textarea> </p> </td> </tr> </table> Any help is appreciated, thanks everyone! How do I hide my javascript from html page (from view source on right click)?
hey all- i have been thinking about how i wanted to tackle this for a while now, and it is now "down to the wire"... so in my page i have two nav bars, one for js enabled and one for js disabled... they are styled accordingly (the js disabled is display:inherit; and the js enabled is display:none now i may need to tweak those styles after i get the script working, but that i can toy with after i get this working... anyways- my pages get the navbar inherited from a master page- so my thought was (to prevent loops) make a nav bar that had all js disabled links and a navbar that had all js enabled... then in my code i put in this script Code: <script type="text/javascript"> document.getElementById("Nav_Menu_JS_Content").style.display = "inherit"; document.getElementById("Nav_Menu_Content").style.display = "none"; </script> now i am not amazing with js but i figured this would work... i get an error thrown every time though Quote: Microsoft JScript runtime error: Unable to get value of the property 'style': object is null or undefined now i assume (i am watching in debug) that this is because it is hitting the script before the rest of the page writes... but if i move the script below then the script never fires... ? here are the two nav bar ID's Note: i encapsulated the menus in <div>s and targeted the divs to ensure that there were no conflictions with my asp Code: <div id="Nav_Bar_Menu_Content" class="Nav_Menu"> ......... <div id="Nav_Menu_JS_Content" class="Nav_Menu_JS"> Hi, I have three tables and I want show one table at one time. At the bottom of one table I need to have "next" and "previous" links to go other two tables.Can you please help me. Thank You. HELP NEEDED URGENTLY... Hi all, previously i posted a thread on How to HIDE a link at a certain time using javascript but now i realize i actually need the codes such that it can be implement inside the sharepoint. http://codingforums.com/showthread.p...085#post894085 One problem i encounter is that the "getElementById" is not able to control the link that i'm trying to hide. Currently what i have is this sharepoint site whereby there is a particular link that i need to hide it at a certain time and the problem now is that in sharepoint i cannot obtain the 'div id' of the control (controls refers to the combo box, text etc) in the sharepoint site. Plz help..thanks! http://www.suttonsilver.co.uk/client...on-calculator/ Please visit the above website, Click on a Injury Type (try Minor Head Injury) on the right hand side (the human figure) Then click on the Calculate button and you will see a "calculated" figure appear, if you then click on another injury type then calculate it again, another Div will show. If two "You could be entitled up..." DIVs pop up, the previous, initially calculated 'result' should be removed and replaced by the new 'result'. Can anyone help me do this? Also.. as a side note, does anyone have a solution for when clicking calculate, two divs show up... (i.e. a 'result' and a 'contact us form'). Cheers Chris SS |