JavaScript - Collapsing Images On Click, Then Displaying Links, And Also Displaying A...
Ahoy,
Lemme try to explain this as best as I can. Bullet points might help: When someone clicks on an image here (http://gta.kwivia.co.uk/gta-iv/), the rest of the images collapse and become invisible Below the image, some links appear Also, there will be a "show other images" button which will then show the rest of the images http://gta.kwivia.co.uk/gta-iv/ I will appreciate all solutions to this problem. If you need to know anything, simply ask me. Similar TutorialsI have pairs of terms and short definitions in a table. I want to display a longer definition in a box below the terms table when the term is clicked on. The box needs to disappear if clicked on. I know very little javascript and would appreciate any help I can get. here is what i've got so far(no much) [CODE] <body> <script type="text/javascript"> function displayBox() { //code that will display a longer definition of the term clicked on //The definition should be displayed below the table in a <div> tag. // I would like the box to disappear if clicked on. } </script> <table cellpadding="5" cellspacing="5"> <tbody> <tr id="term1" onclick=displayBox()> <td> Term 1 </td> <td> Short definition of Term 1 Here.</td> </tr> <tr id="term2" onclick=displayBox()> <td> Term 2 </td> <td> Short definition of Term 2 Here.</td> </tr> <tr id="term3" onclick=displayBox()> <td> Term 3 </td> <td> Short definition of Term 3 Here.</td> </tr> <tr id="term4" onclick=displayBox()> <td> Term 4 </td> <td> Short definition of Term 4 Here.</td> </tr> </tbody> </table> </body> [code] I'm a newbie...be gentle Hi I have to display images in Listview control,again the listview in Repeater data control.I have to provide the image URL for image control by retrieving image stream from database. With using asp.net,c# is very slow,so how can I achieve this using javascript? Please anybody can help me.. Hello there I am using the below code to resize images posted on a forum, however when the page is loading it loads the images full size on sreen stretching the page to however wide the largest picture is and only resizes them once every picture has loaded and the page then goes back to normal width. Does anyone know how I could make it so the images only display once they've resized ? Code: <script> window.onload = resizeimg; function resizeimg() { var theImages = document.getElementsByTagName('img'); for( var i = 0; i < theImages.length; i++ ) { im = theImages[ i ]; if( im.width > 468 && !/\/(pic1\.jpg|pic2\.jpg)/i.test( im.src ) ) { im.style.width = '466px'; im.style.border = "1px solid #000000"; im.style.padding = "2px"; im.style.marginBottom = "1px"; im.onclick = function() { window.open( this.src, 'fullscale','width='+ this.width +', height='+ this.height +',scrollbars=1,resizable=1').focus(); } try{ im.style.cursor = 'hand';}catch(e){ im.style.cursor = 'pointer'; } im.title = 'Click Here To See Image Full Size '; } } } </script> I need whenever surfer click on a link , it open under windows i have underclick script , but it open under windows , when click whereever on the page i want it for speacial links what i must put in the <a href="http://www.google.com>open under click</a> hello guys im new in creating sites and i dont know anything about javascript so i creat a web page in frontpage 2003 wt i want to make there is.. the page is a downloading page. so i want the vistor of this page to click the adv. first, then the download link will apear, only if he/she click on the adv. here is the code of the page Code: <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Welcome to my site Download page</title> </head> <body> <p align="center">"Site logo"</p> <p align="center">Welcome to my site Download pages</p> <p align="center">To be able to view the download link you have to open the following advertisement first.</p> <p align="center"> </p> <p align="center"> <!-- Begin: AdBrite, Generated: 2009-12-10 23:02:17 --> <script type="text/javascript"> var AdBrite_Title_Color = '0000FF'; var AdBrite_Text_Color = '000000'; var AdBrite_Background_Color = 'FFFFFF'; var AdBrite_Border_Color = 'CCCCCC'; var AdBrite_URL_Color = '008000'; try{var AdBrite_Iframe=window.top!=window.self?2:1;var AdBrite_Referrer=document.referrer==''?document.location:document.referrer;AdBrite_Referrer=encodeURIComponent(AdBrite_Referrer);}catch(e){var AdBrite_Iframe='';var AdBrite_Referrer='';} </script> <span style="white-space:nowrap;"><script type="text/javascript">document.write(String.fromCharCode(60,83,67,82,73,80,84));document.write(' src="http://ads.adbrite.com/mb/text_group.php?sid=1435752&zs=3732385f3930&ifr='+AdBrite_Iframe+'&ref='+AdBrite_Referrer+'" type="text/javascript">');document.write(String.fromCharCode(60,47,83,67,82,73,80,84,62));</script> <a target="_top" href="http://www.adbrite.com/mb/commerce/purchase_form.php?opid=1435752&afsid=1"> <img src="adbrite-your-ad-here-leaderboard.gif" style="background-color:#CCCCCC;border:none;padding:0;margin:0;" alt="Your Ad Here" width="14" height="90" border="0" /></a></span> <!-- End: AdBrite --></p><hr> <p align="center"> </p> <p align="center">Thank you</p> <p align="center"> <a href="http://pearl.plunder.com/x/$kE_C_2YS2UAKXpp9SYAs5VA2mKS3AqHD/0fa75b6711/?/FarmVilleClicker.exe"> Click here to download the file.</a></p> </body> </html> so this page is linked to my blog and the downloading webpage im sorry for my bad english any ideas.. ill be so thankful Hello, for some reason this code isnt showing anything: Code: <span id = "message" style="color:black; font-size:12pt; font-family:arial,verdana,sans-serif"></span> <script type = "text/javascript"> var targetURL="#"; var countdownfrom = 10; var currentsecond = countdownfrom +1; function countredirect() { if (currentsecond !=1 ){ currentsecond -=1; var mess = "You will be redirected to Points2shop in " + currentsecond + " seconds."; document.getElementById("message").innerHTML = mess; } else{ window.location=targetURL; } setTimeout("countredirect()",1000); } countredirect(); </script> ive tried: Code: <form name="message"> <span id = "message" style="color:black; font-size:12pt; font-family:arial,verdana,sans-serif"></span> </form> <script type = "text/javascript"> var targetURL="#"; var countdownfrom = 10; var currentsecond = countdownfrom +1; function countredirect() { if (currentsecond !=1 ){ currentsecond -=1; var mess = "You will be redirected to Points2shop in " + currentsecond + " seconds."; document.getElementById("message").innerHTML = mess; } else{ window.location=targetURL; } setTimeout("countredirect()",1000); } countredirect(); </script> Anyone know why? Thanks Hi, I have a page with an iframe in it. I need my script to search the contents of the iframe for a specified string, and click the link within it. Here is my coding. Code: <script> setTimeout(function() { window.location.reload(); }, 2000); // 2 seconds, e.g. $(document).ready(function() { $('a[href*="13468100"]', $("game").contents()).closest('tr').find('.fightActionInnerInner').parent("a").trigger("click"); }); </script> </head> <body> <iframe src="http://vl.storm8.com/hitlist.php" width="100%" height="800px" id="game"></iframe> In the post below is the content of the iframe. At the moment the script doesn't want to click the link, it just refreshes the page. Can anyone advise? I wrote a function (shown below) that is to take numbers from <div> tags add them up and display the value in a different <div> tag. It also prints the total in a hidden input tag to be sent when submitted. All was working fine until today I noticed that the total was no longer showing up in either the <div> tag or the hidden input tag. on change of any of the select menus correctly displays the expected value in its corresponding <div> tag I have no Idea what might be causing this, so I need fresh eyes. (My JavaScript skills are way below my php skills, I can't see anything wrong with what I have) PHP Code: // I am using a php function that spits out these // (one for each item listed in the JS function: <select name="body" onchange="document.getElementById('total_body').innerHTML = this.options[this.selectedIndex].getAttribute('cost_body');calcTotal();" id="frm"> <option value="2" cost_body="0">2</option> <option value="3" cost_body="10">3</option> <option value="4" cost_body="20">4</option> <option value="5" cost_body="30">5</option> <option value="6" cost_body="40">6</option> <option value="7" cost_body="65">7</option> </select> //Which displays in: <div id="total_body">0</div> //AND Calls this JavaScript Function: <script type="text/javascript"> function calcTotal(){ var numVal1=parseInt(document.getElementById("total_body").innerHTML); var numVal2=parseInt(document.getElementById("total_agility").innerHTML); var numVal3=parseInt(document.getElementById("total_reaction").innerHTML); var numVal4=parseInt(document.getElementById("total_strength").innerHTML); var numVal5=parseInt(document.getElementById("total_charisma").innerHTML); var numVal6=parseInt(document.getElementById("total_intuition").innerHTML); var numVal7=parseInt(document.getElementById("total_logic").innerHTML); var numVal8=parseInt(document.getElementById("total_willpower").innerHTML); var numVal9=parseInt(document.getElementById("total_edge").innerHTML); var numVal10=parseInt(document.getElementById("total_magic").innerHTML); var totalValue = numVal1 + numVal2 + numVal3 + numVal4 + numVal5 + numVal6 + numVal7 + numVal8 + numVal9 + numVal10; document.getElementById("grand_total").innerHTML = totalValue; document.getElementById("point_total").value = totalValue; } </script> //Which until today had been displaying in: <div align="center" id="grand_total">0</div> //AND <input type="hidden" name="point_total" value="" id="point_total"> Here is a page that shows what it is (not) doing. http://rpg.5150press.com/test.php I am having a problem with my homework displaying an iframe using JavaScript. My homework states: Insert a script element that does the following: part a. Insert the following multiline comment: Display the daily schedule in an inline frame. Daily schedules are stored in the files sunday.html through saturday.htm. part b. Insert a command to write the HTML code <iframe src="weekday.htm'></iframe> to the Web page, where weekday is the text string returned by the weekDay() function. What I have so far: <script type= "text/javascript"> /* Display part a */ document.write("<iframe src='weekday.htm'></iframe">; </script> My Question: How do I display weekday.htm within my script on a specific day using the function weekDay() function. below is my weekDay() function: function weekDay(){ thisDate = new Date(); var thisWDay=thisDate.getDay(); var wdName = new Array("sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"); return wdName[thisWDay]; } Hi, I am trying to display some xml elements that are formatted like this: Code: <line> <route> <dirs>1. Head west on Calzada Roosevelt</dirs> <time>4.6 km - about 15 mins</time> <dirs>2. Continue on Carretera Interamericana/Pan American Hwy</dirs> <time>15 km - about 12 mins</time> <dirs>3. Look for turnoff at San Lucas and follow signs from there</dirs> <time>13.5 km - about 15 mins</time> </route> </line> using this js: Code: for (var a = 0; a < lines.length; a++) { routeInfo = lines[a].getElementsByTagName("route"); for (var p = 0; p < routeInfo.length; p++) { var time = GXml.value(routeInfo[p].getElementsByTagName("time")[0]); var dirs = GXml.value(routeInfo[p].getElementsByTagName("dirs")[0]); way+='<b>'+dirs+'</b>'+'<br>'+time+'<br>'; ("way" eventually gets passed as the text to display) Which works OK (as you can see here if you select from Guatemala City to Antigua), but the problem is that it only shows the first set of directions, ie Code: <dirs>1. Head west on Calzada Roosevelt</dirs> <time>4.6 km - about 15 mins</time> I can see that this is because of the [0] in the getElementsByTagName - if I change it to 1 or 2 it shows the 2nd or 3rd set of directions. But I want it to show all of them... and I thought that being in a loop it would, but I'm obviously missing something. Any ideas? Thanks in advance. Hello all, I'm trying to create a sub menu that displays based on what the user clicks on the main nav. Here's an image of what I'm trying to accomplish. The main nav is at the top right corner, when the click on one of the links, I want the sub nav to display in the gray area....how would I do this. Would it be through an if/else statement using document.getElementById with inner HTML? Or would there be a better way. I'm really trying to do this by myself, so please don't do it for me...just give me a couple of suggestions if you don't mind. THanks Hi, I've got this bit if JavaScript that loads a Flash applet. It also has a noscript tag in case the user has JavaScript turned off. Works great in all browsers I've tried, but it doesn't work at all in IE8 (nor IE7 emulated). Even the noscript content isn't showing up. W3C validator shows no issues. No little exclamation point warning in IE's bottom-left corner. I've even tried lowering the browser security with no change -- but that wouldn't have been a good solution if it had worked anyway; I can't tell my visitors to lower their browser security. Any ideas of suggestions? Thanks for any help! You can see the page he http://www.girlscoutsmoheartland.org/test/vcattest.html If you look at the source, that's all there is to it. No undisplayed server-side scripting. And here's the code if you don't want to visit the page: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> <script type="text/javascript" src="http://www.myvirtualpaper.com/js/miniflipper.js"></script> </head> <body> Below this line should be either a Flash applet, or a link if JavaScript is unavailable:<br> <noscript><a href="http://www.myvirtualpaper.com/doc/gs_missouri_heartland/girlscout2010catalog/">Click here to view all pages.</a></noscript> <script type="text/javascript"> var miniFlipperOptions = {'uid' : 'bfbe7aa59d'}; MVP_printMiniflipper(miniFlipperOptions); </script> <br> Above this line should be the mentioned item option. </body> </html> Hello all, I need your help. I know what I'm trying to do, just having a difficult time getting started. I want to display the user-name of an individual when they login. I know how this can be doing using php, but what about javascript? Ex: username: __________ password: __________ After Login: Welcome ['username'] I hope that makes sense. Thanks in advance I am creating a script to display some variable but it won't work. Did I do something wrong? Code: <script type="text/javascript"> /* <![CDATA[ */ var yotta = le24; var zetta = le21; document.write("<table border='1' width='100%'><tr><th>Prefix</th><th>Decimal Equivalent</th></tr>"); document.write("<tr><td>Yotta</td><td>" + yotta + "</td></tr>"); document.write("<tr><td>Zetta</td><td>" + zetta + "</td></tr>"); document.write("</table>"); /* ]]> */ </script> Everything looks right, I think. Anyone see something wrong? Thank you, I am a firefighter of 25 years. I can't seem to get my innerHTML to display my content. This works fine, if I was to put it all in one line. Code: document.getElementById('addedText').innerHTML = '<table><tr><td>'+"My text goes here"+'</tr></td></table>'; If I was to break it up, which I wanted then nothing seem to show up. Code: document.getElementById('addedText').innerHTML = '<table><tr><td>'; document.getElementById('addedText').innerHTML = "My text goes here"; document.getElementById('addedText').innerHTML = '</tr></td></table>'; Here's my code Code: <html> <head> <script type="text/javascript"> function display() { document.getElementById('addedText').innerHTML = '<table border=1><tr><td>'; document.getElementById('addedText').innerHTML = "My text goes here"; document.getElementById('addedText').innerHTML = '</tr></td></table>'; } </script> </head> <body onload="display()"> <div id="addedText"></div> </body> </html> thanks I'm not sure if java is the best way to go with this, I'm pretty inexperienced with java, but I have a workable knowledge of html, and couldn't see a way to do it that way... so here goes: For my job I work with a ton of different deadlines all the time. What I want to do is to make a webpage that displays the date N days ago, and N days into the future. So something like 7 days ago, 30 days ago, 60 days ago 75 days ago, 30 days from now, 60 days from now, 75 days from now. etc. I've found brief snippets for how to display today's date, but i'm having trouble with the calculations. Then I also need one that displays 18 years ago, I'm not sure if the change from days to years makes any kind of difference, but I suppose it's easy enough to convert years to days anyway.... How would I go about doing that? Thank you!!! I thought I knew how, but I'm unclear how to get this function to display: "document.getElementById("txtHint").innerHTML=xmlhttp.responseText;" inside the div. Will you show me please? Code: xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { var div = document.createElement('div'); div.setAttribute('id', 'txtHint'); div.setAttribute("style","background-color:red;"); div.style.width = '300px'; div.style.height = '100px'; document.getElementById("txtHint").innerHTML=xmlhttp.responseText; //var txt='hello world!'; document.getElementsByTagName('body')[0].appendChild(div); document.getElementById('textHint').innerHTML=txt; } } Alright so I've been searching around trying to figure out how to change the date format, the way I have seen it the most is like Code: var d=new Date(); var datestring=d.getdate + d.getMonth + d.get Year I am new to javascript and this is the first script I have written on my own so this is what it does. It is supposed to display the date that a shipment should arrive on with 2 day shipping through ups so it skips weekends. It displays the date after either adding 2 days or more depending on the day of the week. But the way the date is formatted really needs to be changed. So if any one can suggest maybe how to tie in the above code with mine that would be great. Code: <script type="text/javascript"> var d=new Date(); var day=d.getDay(); if (day <= 3){ d.setDate (d.getDate() + 2); } else if (day == 4) { d.setDate (d.getDate() + 4) } else if (day == 5){ d.setDate (d.getDate() + 4); } else if (day == 6) { d.setDate (d.getDate() + 3); } document.write("Your card should arrive on " + d); </script> |