JavaScript - Changing Where The Javascipt Hover Over Appears
Here is the link: http://sovietgaming.com/misc.php?page=roster
We have a roster for Starcraft 2 and when you hover over one of the pictures it displays more info however if you start to scroll and hover you can no longer see it. We need to make so that you can see the hover over no matter where you are on the page. I'm pretty sure the problem is in style #10 of the js code posted below. Code: /* Please refer to readme.html for full Instructions Text[...]=[title,text] Style[...]=[TitleColor,TextColor,TitleBgColor,TextBgColor,TitleBgImag,TextBgImag,TitleTextAlign,TextTextAlign, TitleFontFace, TextFontFace, TipPosition, StickyStyle, TitleFontSize, TextFontSize, Width, Height, BorderSize, PadTextArea, CoordinateX , CoordinateY, TransitionNumber, TransitionDuration, TransparencyLevel ,ShadowType, ShadowColor] */ var FiltersEnabled = 1 // if your not going to use transitions or filters in any of the tips set this to 0 Text[0]=["Forum Username: Soviet_Nova","<li>Best Race: Zerg</li><li>League: Silver</li> <li>Times Online: Afternoons/late night</li> <li>Favorite Custom map: Nexus Wars, Gem TD, Squadron TD, any other T or D really </li> <li>Location: Ft. Collins, Colorado</li>"] Text[1]=["Forum Username: Figgy13","<li>Best Race: Zerg</li><li>League: Gold</li> <li>Times Online: Whenever possible (Wednesday's dedicated to SC2)</li> <li>Favorite custom map: SOTIOS and Risk</li> <li>Location: New Jersey</li>"] Text[2]=["Forum Username: Soviet-Mario","<li>Offrace: meh, i like to offrace as both, but i suppose my toss is better</li><li>Location: New Orleans Louisiana</li> <li>Favorite Gear: Razer Deathadder mouse, banshee headset, marauder keyboard</li> <li>SC1 AKA: Soviet_Mario</li>"] Text[3]=["Forum Username: Cheapliquid","<li>Best Race: Random</li><li>League: Gold</li> <li>Times Online: Randomly all day</li> <li>Favorite Custom map: GEM D</li> <li>Location: The Dirty Jersey</li>"] Text[4]=["Forum Username: Trooper","<li>Best Race: Terran</li><li>League: Master</li> <li>Times Online: Almost every night</li> <li>Favorite Custom map: Nexus Wars</li> <li>Location: Pennsylvania</li>"] Text[5]=["Forum Username: Soviet_Smoke","<li>Best Race: Unknown</li><li>League: Unkown</li> <li>Times Online: Unkown</li> <li>Favorite Custom map: Unkown</li> <li>Location: Unknown</li>"] Text[6]=["Forum Username: MAXPOWER","<li>Best Race: Unknown</li><li>League: Practice</li> <li>Times Online: Never</li> <li>Favorite Custom map: Unknown</li> <li>Location: Southern Colorado</li>"] Text[7]=["Forum Username: Oreo","<li>Best Race: Protoss</li><li>League: High Masters -peaked top 1000's NA</li> <li>Times Online: 3-5, 8-10 weekedays and weekends varies</li> <li>Favorite Custom map: Marine Arena or a MOBA</li> <li>Location: Massachusetts</li>"] Text[8]=["Forum Username: Soviet-cbel","<li>Offrace: Both of my offraces suck, unfortunately</li><li>Stream: None</li> <li>Location: NC</li> <li>Favorite Gear: Logitech/Razer</li> <li>SC1 AKA: None</li>"] Text[9]=["Forum Username: Frosty","<li>Best Race: Random</li><li>League: Diamond</li> <li>Times Online: Medium Activity</li> <li>Favorite Custom map: Squadron/hero attack/zealot frenzy</li> <li>Location: Edmonton, Alberta, Canada</li>"] Text[10]=["Forum Username: Wartourist","<li>Best Race: Terran</li><li>League: Diamond</li> <li>Times Online: Mostly week nights</li> <li>Favorite Custom map: Mafia</li> <li>Location: Montreal, Canada</li>"] Text[11]=["Forum Username: Soviet_Nova","<li>Best Race: Zerg</li><li>League: Silver</li> <li>Times Online: Afternoons/late night</li> <li>Favorite Custom map: Nexus Wars, Gem TD, Squadron TD, any other T or D really </li> <li>Location: Ft. Collins, Colorado</li>"] Text[12]=["Forum Username: Soviet_Hegemon","<li>Best Race: Terran</li><li>League: Silver/Scrub</li> <li>Times Online: Sporadically</li> <li>Favorite Custom map: BattleCraft and Desert Strike</li> <li>Location: Everett,WA</li>"] Text[13]=["Forum Username: Acid","<li>Off Race: Zerg</li> <li>Stream: twitch.tv/sGAcid </li> <li>Location: Upstate New York</li> <li>Favorite Gear: Logitech</li> <li>Location: Upstate New York</li> <li>SC1 AKA: Soviet_Acid</li>"] Text[14]=["Forum Username: Hauskta","<li>Offrace: Terran</li> <li>Stream: http://www.twitch.tv/haustka</li> <li>Location: Tucson, Arizona</li> <li>Favorite Gear: Logitech</li> <li>SC1 AKA: Soviet_Haustka</li>"] Text[15]=["Forum Username: Soviet_Greywolf","<li>Offrace: None</li><li>Stream: None</li> <li>Location: Everett, WA</li> <li>Favorite Gear: Logitech</li> <li>SC1 AKA: Soviet_Greywolf</li>"] Text[16]=["Forum Username: Soviet_Nova","<li>Best Race: Zerg</li><li>League: Silver</li> <li>Times Online: Afternoons/late night</li> <li>Favorite Custom map: Nexus Wars, Gem TD, Squadron TD, any other T or D really </li> <li>Location: Ft. Collins, Colorado</li>"] Text[17]=["Forum Username: MAXPOWER","<li>Best Race: Unknown</li><li>League: Practice</li> <li>Times Online: Never</li> <li>Favorite Custom map: Unknown</li> <li>Location: Southern Colorado</li>"] Text[18]=["Forum Username: Maesy","<li>Best Race: Random</li><li>League: Diamond</li> <li>Times Online: Scattered depending on work schedule</li> <li>Favorite Custom map: Gem TD/Desert Strike equally.</li> <li>Location: Florida</li>"] Text[19]=["Forum Username: PeaceSC2","<li>Best Race: Terran</li><li>League: Masters</li> <li>Times Online: Depends on the day</li> <li>Favorite Custom map: no idea</li> <li>Location: Vancouver BC, Canada</li>"] Text[20]=["Forum Username: Link uK","<li>Best Race: Zerg</li><li>League: Diamond</li> <li>Times Online: Any other day but Wed.</li> <li>Favorite Custom map: Any map made by Darglein or Multitasking trainer.</li> <li>Location:Don't Be a Creep Bro</li>"] Text[21]=["Forum Username: Kenjiman","<li>Best Race: Zerg</li><li>League: Diamond</li> <li>Times Online: Whenever i dont have homework or midterms/finals.</li> <li>Favorite Custom map: Don't really have one..</li> <li>Location: Cal Poly San Luis Obispo</li>"] Text[22]=["Forum Username: DCE_Mason","<li>Best Race: Zerg</li><li>League: Platinum</li> <li>Times Online:After school (4pm-10pm CST)</li> <li>Favorite Custom map: 1v1 Obs Metalopolis Slime</li> <li>Location: Chicago, IL</li>"] Text[23]=["Forum Username: MicroSyntax","<li>Offrace: No! There is no Offrace, there is only one race and it has machineguns and women with long legs. </li><li>Stream: under construction</li> <li>Location: Canoobian</li> <li>Favorite Gear: If it moves or clicks, I like it. </li> <li>SC1 AKA: None</li>"] Text[24]=["Forum Username: TeamSnorlax","<li>Best Race: Protoss</li><li>League: Platinum</li> <li>Times Online: Afternoon / Evening Central</li> <li>Favorite Custom map: N/A</li> <li>Location: Chicago, IL, USA/li>"] Text[25]=["Forum Username: SniperRome","<li>Best Race: Protoss (Random)</li><li>League: High Masters</li> <li>Times Online: Random</li> <li>Favorite Custom map: Starjeweled, Diplomacy</li> <li>Location: Alberta, Canada</li>"] Text[26]=["Forum Username: Swordy","<li>Best Race: Zerg</li><li>League: Diamond</li> <li>Times Online: Frequently</li> <li>Favorite Custom map: MageCraft + RMC</li> <li>Location: Devon, United Kingdom</li>"] Text[27]=["Forum Username: fox","<li>Best Race: Terran</li><li>League: High Masters</li> <li>Times Online: All the time</li> <li>Favorite Custom map: None</li> <li>Location: USA</li>"] Text[28]=["Forum Username: CivilAnarchy","<li>Best Race: Zerg</li><li>League: Master</li> <li>Times Online: Highly active but varied times</li> <li>Favorite Custom map: Phantom Mode</li> <li>Location: Voorhees New Jersey</li>"] Text[29]=["Forum Username: nobodyWondeR","<li>Best Race: Terran</li><li>League: Master</li> <li>Times Online: weekdays 3-5:30pm PST</li> <li>Favorite Custom map: metalopolis, shattered, antiga</li> <li>Location: California</li>"] Text[30]=["Forum Username: steveyy153","<li>Best Race: Protoss</li><li>League: Master</li> <li>Times Online: Weekends and whenever else I have time</li> <li>Favorite Custom map: Civ Sapphire</li> <li>Location: Bloomington, Indiana</li>"] Text[31]=["Forum Username: Nemesis","<li>Best Race: Protoss</li><li>League: Master</li> <li>Times Online: Whenever I can, usually mid evning to early morning</li> <li>Favorite Custom map: None</li> <li>Location: Nova Scotia, Canada</li>"] Text[32]=["Forum Username: Lane_","<li>Best Race: Zerg</li><li>League: Diamond</li> <li>Times Online: Always</li> <li>Favorite Custom map: Star Battle, Risk</li> <li>Location: USAr</li>"] Text[33]=["Forum Username: Defrath","<li>Best Race: Protosss</li><li>League: Diamond</li> <li>Times Online: After 5</li> <li>Favorite Custom map: BW Fall of the Dark Lord, or BW Bunker Wars.e</li> <li>Location: Schenectady, New York.</li>"] Text[34]=["Forum Username: ExO","<li>Best Race: Protoss</li><li>League: Master</li> <li>Times Online: N/A</li> <li>Favorite Custom map: N/A </li> <li>Location: Houston, Texas </li>"] Text[35]=["Forum Username: Haro","<li>Stream: None</li><li>Offrace: Zerg None</li> <li>Location: New York City</li> <li>Favorite Gear: None</li> <li>Sc1 AKA: None</li>"] Text[36]=["Forum Username: ZimZam","<li>Stream: None</li><li>Offrace: Zerg</li> <li>Location: Portland, Oregon</li> <li>Favorite Gear: Rapoo </li> <li>Sc1 AKA: Zimri</li>"] Text[37]=["Forum Username: Voodoo","<li>Stream: None</li><li>Offrace: Was top Dia z, currently playing as low Dia p </li> <li>Location: Tornot, Ontario, Canada </li> <li>Favorite Gear: I use a laptop and a logitech g9x dontlaughatme</li> <li>Sc1 AKA: None</li>"] Text[38]=["Forum Username: daSnake","<li>Stream: None</li><li>Offrace: Toss is all I know</li> <li>Location: what is this? AOL? FL</li> <li>Favorite Gear: Razer all the way</li> <li>Sc1 AKA: Soviet_da5nake good times... I have another one but can't remember</li>"] Text[39]=["Forum Username: SuzumiyauK","<li>Stream: None</li><li>Offrace: None</li> <li>Location: Toronto, Ontario</li> <li>Favorite Gear: Headphone: Bose Mouse: Steelseries Keyboard: Logitech </li> <li>Sc1 AKA: SuzumiyauK, GeneraluK, Mystic_Raptor, FoW_Raptor, NoVa</li>"] Text[40]=["Forum Username: SlamDuncan","<li>Stream: SlamDuncan64 on twitchtv</li><li>Offrace: I play random lol</li> <li>Location: Canada</li> <li>Favorite Gear: Steeleseries and Razer mix</li> <li>Sc1 AKA: None</li>"] Text[41]=["Forum Username: Drpoppler","<li>Stream: justin.tv/drpoppler</li><li>Offrace: Protoss</li> <li>Location: Canada eh?</li> <li>Favorite Gear: Logitech</li> <li>Sc1 AKA: None</li>"] Text[42]=["Forum Username: Crevasse","<li>Stream: None</li><li>Offrace: Protoss</li> <li>Location: CA</li> <li>Favorite Gear: Filco, Steelseries</li> <li>Sc1 AKA: None</li>"] Text[43]=["Forum Username: Dystopian","<li>Stream: http://www.teamliquid.net/video/streams/Dystopian</li><li>Offrace: Terran</li> <li>Location: Arizona</li> <li>Favorite Gear: Logitech</li> <li>Sc1 AKA: None</li>"] Text[44]=["Forum Username: sGstorm","<li>Stream: twitch.tv/jgreen46</li><li>Offrace: Protoss like a boss</li> <li>Location: Vancouver, Canada</li> <li>Favorite Gear: Sentinel Zero-G Mouse. Changeable mouse weight? YES PLZ.</li> <li>Sc1 AKA: hizzlemafizzle, fox not sGFox</li>"] Text[45]=["Forum Username: eFeKZ","<li>Stream: http://www.twitch.tv/eFeKZ</li><li>Offrace: Zerg Top8Masters</li> <li>Location: Currently Costa Rica (Soon Canada again)</li> <li>Favorite Gear: Razer / Steel Series</li> <li>Sc1 AKA: fLow</li>"] Text[46]=["Forum Username: AceGeneral","<li>Stream: None</li><li>Offrace: Oh God No!</li> <li>Location: Corn State of Indiana</li> <li>Favorite Gear: LOL what gear</li> <li>Sc1 AKA: Ace</li>"] Text[47]=["Forum Username: Defrath","<li>Best Race: Protosss</li><li>League: Diamond</li> <li>Times Online: After 5</li> <li>Favorite Custom map: BW Fall of the Dark Lord, or BW Bunker Wars.e</li> <li>Location: Schenectady, New York.</li>"] Text[48]=["Forum Username: Kaiser","<li>Stream: None</li><li>Offrace: I only play Zerg because I have self-respect</li> <li>Location: British Columbia, Canada</li> <li>Favorite Gear: My trusty MX518.</li> <li>Sc1 AKA: None</li>"] Text[49]=["Forum Username: Comedian","<li>Stream: None</li><li>Offrace: all</li> <li>Location: Purdue University</li> <li>Favorite Gear: None</li> <li>Sc1 AKA: None</li>"] Text[50]=["Forum Username: Swordy","<li>Stream: None</li><li>Offrace: None</li> <li>Location: Devon, United Kingdom England</li> <li>Favorite Gear: Logitech</li> <li>Sc1 AKA: MyWifeForAiur, Soviet_Sword</li>"] Text[51]=["Forum Username: Blank","<li>Stream:</li><li>Offrace:</li> <li>Location: </li> <li>Favorite Gear: </li> <li>Sc1 AKA:</li>"] Text[52]=["Forum Username: MAXPOWER","<li>Best Race: Unknown</li><li>League: Practice</li> <li>Times Online: Never</li> <li>Favorite Custom map: Unknown</li> <li>Location: Southern Colorado</li>"] Text[53]=["Forum Username: Acid","<li>Off Race: Zerg</li> <li>Stream: twitch.tv/sGAcid </li> <li>Location: Upstate New York</li> <li>Favorite Gear: Logitech</li> <li>Location: Upstate New York</li> <li>SC1 AKA: Soviet_Acid</li>"] Text[54]=["Forum Username: Soviet-Mario","<li>Offrace: meh, i like to offrace as both, but i suppose my toss is better</li><li>Location: New Orleans Louisiana</li> <li>Favorite Gear: Razer Deathadder mouse, banshee headset, marauder keyboard</li> <li>SC1 AKA: Soviet_Mario</li>"] Style[0]=["white","black","#000099","#E8E8FF","","","","","","","","","","",200,"",2,2,10,10,51,1,0,"",""] Style[1]=["white","black","#000099","#E8E8FF","","","","","","","center","","","",200,"",2,2,10,10,"","","","",""] Style[2]=["white","black","#000099","#E8E8FF","","","","","","","left","","","",200,"",2,2,10,10,"","","","",""] Style[3]=["white","black","#000099","#E8E8FF","","","","","","","float","","","",200,"",2,2,10,10,"","","","",""] Style[4]=["white","black","#000099","#E8E8FF","","","","","","","fixed","","","",200,"",2,2,1,1,"","","","",""] Style[5]=["white","black","#000099","#E8E8FF","","","","","","","","sticky","","",200,"",2,2,10,10,"","","","",""] Style[6]=["white","black","#000099","#E8E8FF","","","","","","","","keep","","",200,"",2,2,10,10,"","","","",""] Style[7]=["white","black","#000099","#E8E8FF","","","","","","","","","","",200,"",2,2,40,10,"","","","",""] Style[8]=["white","black","#000099","#E8E8FF","","","","","","","","","","",200,"",2,2,10,50,"","","","",""] Style[9]=["white","black","#000099","#E8E8FF","","","","","","","","","","",200,"",2,2,10,10,51,0.5,75,"simple","gray"] Style[10]=["white","white","#2C2C2C","#2C2C2C","http://soviet.scdiplo.com/images/gamer/nav_sub.png","","center","left","Verdana","Verdana","center","",2,2,300,100,2,20,10,0,50,1,80,"complex","gray"] Style[11]=["white","white","#000099","#E8E8FF","","","","","","","","","","",200,"",2,2,10,10,51,0.5,45,"simple","gray"] Style[12]=["white","black","#000099","#E8E8FF","","","","","","","","","","",200,"",2,2,10,10,"","","","",""] applyCssFilter() What should be done to fix it? Thank you! Similar Tutorialstrying to find a example of when you hover over a image, text appears on the bottom so it could be a picture of a dog, whne you put your mouse over it, text will show in the picture (ie* transparent background for text so it's readable) anywhre where I can find a example of this???? Hey guys, So I have a top navigation bar with links in it and when I hoover over a link I want the navigation bars background image to change. The links are actually Images with an <a href=""></a> tag around them. The site isn't live so I can't give you a link. Here is the code: HTML ( I want the id="Nav" background to change when I hover over the "Home" "Forums" "Downloads" "Contact" Images ) Code: <div id="Nav"> <div id="Splitters" class="clearfix"> <div id="group1"> <img id="Layer_3_copy" src="images/Layer_3_copy.png" alt="" width="2" height="65" /> </div> <div id="group2"> <img id="Layer_3_copy_3" src="images/Layer_3_copy.png" alt="" width="2" height="65" /> </div> <div id="group3"> <img id="Layer_3_copy_4" src="images/Layer_3_copy_3.png" alt="" width="2" height="67" /> </div> </div> <div id="Nav_Text" class="clearfix"> <a href="#"> <img id="Home" src="images/Home.png" alt="" width="48" height="11" /> </a> <a href="#"> <img id="Forums" src="images/Forums.png" alt="" width="71" height="11" /> </a> <a href="#"> <img id="Downloads" src="images/Downloads.png" alt="" width="109" height="11" /> </a> <a href="#"> <img id="Contact" src="images/Contact.png" alt="" width="80" height="11" /> </a> </div> </div> CSS Code: #Nav { background: url(images/Main.png) no-repeat; left: 0; min-height: 70px; position: absolute; top: 0; width: 100%; } #Splitters { left: 421px; position: absolute; top: 0; width: 334px; } #group1 { display: inline; float: left; margin: 0 0 0 107px; width: 2px; } #Layer_3_copy { clear: both; float: left; margin: 0; width: 2px; } #group2 { float: left; margin: 0 0 0 95px; width: 2px; } #Layer_3_copy_3 { clear: both; float: left; margin: 0; width: 2px; } #group3 { float: right; margin: 0; width: 2px; } #Layer_3_copy_4 { clear: both; float: left; margin: 0; width: 2px; } #Nav_Text { left: 449px; position: absolute; top: 29px; width: 397px; } Hey, I want javascript to change the background image on hover. This is my javascript: Code: function navOver(obj){ var imgUrl = 'url(images/' + obj.id + '.hover.png) center no-repeat'; obj.style.background='imgUrl'; } function navOut(obj){ var imgUrl = 'url(images/' + obj.id + '.png) center no-repeat'; obj.style.background='imgUrl'; } and this is the HTML: Code: <li id="home" onmouseover="navOver(this)" onmouseout="navOut(this)"></li> This doesn't work, can anyone help me and say me what to do? Hi guy not the greatest with javascript i use it now and then. so far i have this code working correctly. Currently on mouse-over its changes the img background of imgholder. this is the HTML Code: <div id="imgholder"> </div> <div id="myController2"> <span class="jFlowControl2">No 1 </span> <span class="jFlowControl2">No 2 </span> </div> <div id="mySlides2"> <div> <a onmouseover="changeImg(this, 'img2.jpg');" class="vm" href="vulnerabiliy.htm" title="Vulnerability Management"></a> <a onmouseover="changeImg(this, 'img3.jpg');" class="grc" href="it_grc.htm" title="IT Governance, Risk and Compliance"></a> <a onmouseover="changeImg(this, 'img4.jpg');" class="pci" href="pci.htm" title="Payment Card Industry Data Security Standard"></a> <a onmouseover="changeImg(this, 'img5.jpg');" class="gcs" href="gcs.htm" title="Government Connect Code of Connection"></a> <a onmouseover="changeImg(this, 'img1.jpg');" class="pt" href="penetration.htm" title="Penetration Testing"> </a> <a onmouseover="changeImg(this, 'img6.jpg');" class="as" href="application.htm" title="Application Security"> </a> <!--span class="jFlowNext2 NextFlash"> </span--> </div> <div> <!--span class="jFlowPrev2 BackFlash"> </span--> </div> </div> </div> This is the script Code: <script language="javascript" type="text/javascript" src="inc/js/changeImg.js"></script> function changeImg(e, imgName) { URL_prefix = 'http://www.website.co.uk/surecloud'; // set image url image_url = new Array(); image_url[0] = URL_prefix+"/images/img1.jpg"; image_url[1] = URL_prefix+"/images/img2.jpg"; image_url[2] = URL_prefix+"/images/img3.jpg"; image_url[3] = URL_prefix+"/images/img4.jpg"; image_url[4] = URL_prefix+"/images/img5.jpg"; image_url[5] = URL_prefix+"/images/img6.jpg"; preload_image_object = new Array(); for(var i = 0; i < image_url.length; i++) { preload_image_object[i] = new Image(); preload_image_object[i].src = image_url[i]; } document.getElementById('imgholder') .style.background="transparent url('images/" + imgName + "') no-repeat"; } currenly if you hover over any of the <a> a css class is applied css code Code: #flash a.grc:hover { -moz-background-clip:border; -moz-background-inline-policy:continuous; -moz-background-origin:padding; background:transparent url(../../images/animated_nav.gif) no-repeat scroll -148px -59px; } what i need to do is keep this class applied over the last <a> that is hovered. so what i would like to do is change the class of the last <a> hover so it stays active until another one is hovered. does this make sense? any help or guidance would be appreciated What I want to make is an html that loop between 2 websites. so it starts out at website "a" (site "a" does have a timer that will redirect on its own) then it switches to website "b", and that goes on for 30 seconds and then switch back over to website "a" and so on forever. If someone could help me out with this, it would be greatly appreciated Dear friends , I tried to write in html page from text file using " <html> <head> <script type="text/javascript" language="javascript"> function Read() { var Scr = new ActiveXObject("Scripting.FileSystemObject"); var CTF = Scr .OpenTextFile("C:\\123.txt", 1, true); data = CTF .ReadAll(); document.write(data); alert(data); CTF .Close(); } </script> </head> <body onLoad="Read()"> </body> </html> " But the contains of text file getting changed , like if there is "My name is Karimkhan I love India " Then it will write like "My name is Karimkhan i love India" It ignores multiple spaces and new line character , so what should I do to prevent this...IS THERE ANYTHING LIKE <PRE> TAG IN HTML "? I hope someone knows a lot about php as well as javascript. I am developing a site that roughly looks like MVC. The site is essentially one page; index.php. Content is displayed according to fragments attached to links like Code: <a href='./?head=home'>Home</a> The index page retrieves the request from this link as Code: $_GET['head'] == 'home' There is an image based widget in the home page with related javacript that is written by php. The widget swaps out a list of images, randomly. All works as written when the user initially loads the index page with default Home content. But if I select one of the nav links, load that content, then nav back to Home there is a javascript variable that keeps causing a 'so and so var not defined error'. Code: <script type="text/javascript"> //<![CDATA[ var _self = '<?php print $_self; ?>'; <?php if(!$_GET['head']) { print "var js = false;\nvar _AJX = new _NEW_REQ();\nwindow.onload = function() { js = _AJX.setCookie(js); }\n"; print "var widgetSrcImg = new Array();\n"; // first case, works here but not in case 2 print "var Widget = new _NEW_WIDGET()\nwindow.onload = function() { var displaySrcPath = 'WC_home/display_img/'; widgetSrcImg = Widget.preload(display, displaySrcPath); Widget.findImg('dispImg') }"; } else if($_GET['head'] == 'home') // case 2 { print "var displaySrcPath = 'WC_home/display_img/';\n"; print "var widgetSrcImg = new Array();\n"; print "var Widget = new _NEW_WIDGET()\nwindow.onload = function() { widgetSrcImg = Widget.preload(display, displayScrPath); Widget.findImg('dispImg', Widget); }"; } /* alternat syntax as in first case doesn't wotk either */ ?> //]]> </script> under 'case 2' displaySrcPath is not defined as far as javascript is concerned Does anyone here have a clue? Thanks for time and attention JK Why javascript?
Hi All, Im new to javascript (new to programming in general!) and I have a date script and a time script that I want to run and placed into a form. The form will be listed as: Date: 21/10/2014 Time: 03:20:00 PM I have the scripts and they are working.. only when I put them both in the same page, only one will work. Date Script: function my_curr_date() { var currentDate = new Date() var day = currentDate.getDate(); var month = currentDate.getMonth() + 1; var year = currentDate.getFullYear(); var my_date = day+"-"+month+"-"+year; document.getElementById("dateField").value=my_date; } <body onload='return my_curr_date();'> Time Script: function DisplayTime(){ if (!document.all && !document.getElementById) return timeElement=document.getElementById? document.getElementById("curTime"): document.all.tick2 var CurrentDate=new Date() var hours=CurrentDate.getHours() var minutes=CurrentDate.getMinutes() var seconds=CurrentDate.getSeconds() var DayNight="PM" if (hours<12) DayNight="AM"; if (hours>12) hours=hours-12; if (hours==0) hours=12; if (minutes<=9) minutes="0"+minutes; if (seconds<=9) seconds="0"+seconds; var currentTime=hours+":"+minutes+":"+seconds+" "+DayNight; timeElement.innerHTML="<font style='font-family:verdana, arial,tahoma;font- size:12px;color:#E25984; font-weight:bold;'>"+currentTime+"</b>" setTimeout("DisplayTime()",1000) } window.onload=DisplayTime ____________________________________ Separately, they both work perfectly. But together, only one will display. Any help is appreciated! Thanks, Jess I already have the html and the php part of my form. My Form already can be verified using only php, but i would also like it to use javascipt so they dont have to load a new page just to say ''this field is blank"" im not very intelligent with javascipt so im just looking that if the user does not have a field that is needed that a red mark comes up around it or next to it saying you need to fill it out. Im using php also for verification just incase someone turns on JavaScript on there browser.. heres my php file 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> </head> <?php $errors = ''; $myemail = 'support@ludemanndistributors.net';//<-----Put Your email address here. if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message'])) { $errors .= "\n Error: all fields are required"; } $name = $_POST['name']; $email_address = $_POST['email']; $message = $_POST['message']; if (!eregi( "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email_address)) { $errors .= "\n Error: Invalid email address"; } if( empty($errors)) { $to = $myemail; $email_subject = "Contact form submission: $name"; $email_body = "You have received a new message. ". " Here are the details:\n Name: $name \n ". "Email: $email_address\n Message \n $message"; $headers = "From: $myemail"; $headers .= "Reply-To: $email_address"; mail($to,$email_subject,$email_body,$headers); //redirect to the 'thank you' page header('Location: contact-form-thank-you.html'); } ?> <body> </body> </html> and heres the html 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>Form</title> </head> <body> <form action='process.php' method=post> <table width="506" height="268" border="0"> <tr> <td width="500"><label> Name (required)<br /> <br /> <input type="text" size="40" maxlength="40" name="Name"> <br /> </label></td> </tr> <tr> <td><label> Email Address (required)<br /> <br /> <input type="text" size="40" maxlength="40" name="Email"> </label></td> </tr> <tr> <td><label> Date of Birth (required)<br /> <br /> <select name='Month'> <option selected></option> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select name='Day'> <option selected></option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select name='YYYY'> <option selected></option> <option value="2012">2012</option> <option value="2011">2011</option> <option value="2010">2010</option> <option value="2009">2009</option> <option value="2008">2008</option> <option value="2007">2007</option> <option value="2006">2006</option> <option value="2005">2005</option> <option value="2004">2004</option> <option value="2003">2003</option> <option value="2002">2002</option> <option value="2001">2001</option> <option value="2000">2000</option> <option value="1999">1999</option> <option value="1998">1998</option> <option value="1997">1997</option> <option value="1996">1996</option> <option value="1995">1995</option> <option value="1994">1994</option> <option value="1993">1993</option> <option value="1992">1992</option> <option value="1991">1991</option> <option value="1990">1990</option> <option value="1989">1989</option> <option value="1988">1988</option> <option value="1987">1987</option> <option value="1986">1986</option> <option value="1985">1985</option> <option value="1984">1984</option> <option value="1983">1983</option> <option value="1982">1982</option> <option value="1981">1981</option> <option value="1980">1980</option> <option value="1982">1982</option> <option value="1981">1981</option> <option value="1980">1980</option> <option value="1979">1979</option> <option value="1978">1978</option> <option value="1977">1977</option> <option value="1976">1976</option> <option value="1975">1975</option> <option value="1974">1974</option> <option value="1973">1973</option> <option value="1972">1972</option> <option value="1971">1971</option> <option value="1970">1970</option> <option value="1969">1969</option> <option value="1968">1968</option> <option value="1967">1967</option> <option value="1966">1966</option> <option value="1965">1965</option> <option value="1964">1964</option> <option value="1963">1963</option> <option value="1962">1962</option> <option value="1961">1961</option> <option value="1960">1960</option> <option value="1959">1959</option> <option value="1958">1958</option> <option value="1957">1957</option> <option value="1956">1956</option> <option value="1955">1955</option> <option value="1954">1954</option> <option value="1953">1953</option> <option value="1952">1952</option> <option value="1951">1951</option> <option value="1950">1950</option> <option value="1949">1949</option> <option value="1948">1948</option> <option value="1947">1947</option> <option value="1946">1946</option> <option value="1945">1945</option> <option value="1944">1944</option> <option value="1943">1943</option> <option value="1942">1942</option> <option value="1941">1941</option> <option value="1940">1940</option> <option value="1939">1939</option> <option value="1938">1938</option> <option value="1937">1937</option> <option value="1936">1936</option> <option value="1935">1935</option> <option value="1934">1934</option> <option value="1933">1933</option> <option value="1932">1932</option> <option value="1931">1931</option> <option value="1930">1930</option> <option value="1929">1929</option> <option value="1928">1928</option> <option value="1927">1927</option> <option value="1926">1926</option> <option value="1925">1925</option> <option value="1924">1924</option> <option value="1923">1923</option> <option value="1922">1922</option> <option value="1921">1921</option> <option value="1920">1920</option> <option value="1919">1919</option> <option value="1918">1918</option> <option value="1917">1917</option> <option value="1916">1916</option> <option value="1915">1915</option> <option value="1914">1914</option> <option value="1913">1913</option> <option value="1912">1912</option> <option value="1911">1911</option> <option value="1910">1910</option> <option value="1909">1909</option> <option value="1908">1908</option> <option value="1907">1907</option> <option value="1906">1906</option> <option value="1905">1905</option> <option value="1904">1904</option> <option value="1903">1903</option> <option value="1902">1902</option> <option value="1901">1901</option> <option value="1900">1900</option> </select> </label></td> </tr> <tr> <td> <label> Comments (required)<br /> <br /> <textarea rows="5" cols="45" name="Comment" wrap="physical"></textarea><br /> </label></td> </tr> </table> <p> <label> <input type="submit" name="Submit" id="button" value="Submit" /> <input type="reset" name="Reset" id="button" value="Reset" /> </label> </p> </form> </body> </html> </html> Thanks in advance. I need to draw like image 1 in file attach. But after i write code: 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> </head> <script type="text/javascript"> function Ve() { var n = document.getElementById("txtGiatri").value; var i,j; for(i=1;i<=n;i++) { for(j=0;j<n-i;j++) document.getElementById ("place").innerHTML +=" "; for(j=i;j>0;j--) { document.getElementById ("place").innerHTML +=j; } document.getElementById ("place").innerHTML +="<br/>"; } } </script> <body> <table> <tr> <td><input name="txtGiatri" type="text" id="txtGiatri" /></td> <td><input name="btnVe" type="button" value="Ve" onclick="Ve();" /></td> </tr> <tr> <td><div id="place"></div></td> <td></td> </tr> </table> </body> </html> i only have like image 2. How i fixed it? I'm making a table that is dynamically populated from XML data. One of the columns refers to an XML tag that is NOT required (hence the tag does not exist in every XML entry). How do I write a statement (if, else, or any other?) that says - check for the tag, if the tag exists, write the tag's data, if the tag does NOT exist, write "n/a". Here's the code: [CODE] <script type="text/javascript"> if (window.XMLHttpRequest) { xhttp=new window.XMLHttpRequest(); } else // Internet Explorer 5/6 { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET","http://www.mysite.com/file.xml",false); xhttp.send(""); xmlDoc=xhttp.responseXML; document.write("<table border='0' style='font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#333333; border:#333333 1px solid; text-align:center' cellpadding='5' cellspacing='0'>"); document.write("<tr><td style='border-bottom:#333333 1px solid'><strong>Type</strong></td><td style='border-bottom:#333333 1px solid'><strong>Name</strong></td><td style='border-bottom:#333333 1px solid'><strong>Details</strong></td><td style='border-bottom:#333333 1px solid'><strong>Code<br>(if applicable)</strong></td><td style='border-bottom:#333333 1px solid'><strong>Start Date</strong></td><td style='border-bottom:#333333 1px solid'><strong>End Date</strong></td></tr>"); var x=xmlDoc.getElementsByTagName("link"); for (i=0;i<x.length;i++) { document.write("<tr><td style='border-bottom:#333333 1px solid'>"); document.write(x[i].getElementsByTagName("type")[0].childNodes[0].nodeValue); document.write("</td><td style='border-bottom:#333333 1px solid'>"); document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue); document.write("</td><td style='border-bottom:#333333 1px solid'>"); document.write(x[i].getElementsByTagName("description")[0].childNodes[0].nodeValue); document.write("</td><td style='border-bottom:#333333 1px solid'>"); document.write(x[i].getElementsByTagName("code")[0].childNodes[0].nodeValue); document.write("</td><td style='border-bottom:#333333 1px solid'>"); document.write(x[i].getElementsByTagName("startdate")[0].childNodes[0].nodeValue); document.write("</td><td style='border-bottom:#333333 1px solid'>"); document.write(x[i].getElementsByTagName("enddate")[0].childNodes[0].nodeValue); document.write("</td></tr>"); } document.write("</table>"); </script> [CODE] Thanks, M8AL I'm making a table that is dynamically populated from XML data. One of the columns refers to an XML tag that is NOT required (hence the tag does not exist in every XML entry). How do I write a statement (if, else, or any other?) that says - check for the tag, if the tag exists, write the tag's data, if the tag does NOT exist, write "n/a". Here's the code: Thanks! [CODE] <script type="text/javascript"> if (window.XMLHttpRequest) { xhttp=new window.XMLHttpRequest(); } else // Internet Explorer 5/6 { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET","http://www.mysite.com/file.xml",false); xhttp.send(""); xmlDoc=xhttp.responseXML; document.write("<table border='0' style='font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#333333; border:#333333 1px solid; text-align:center' cellpadding='5' cellspacing='0'>"); document.write("<tr><td style='border-bottom:#333333 1px solid'><strong>Type</strong></td><td style='border-bottom:#333333 1px solid'><strong>Name</strong></td><td style='border-bottom:#333333 1px solid'><strong>Details</strong></td><td style='border-bottom:#333333 1px solid'><strong>Code<br>(if applicable)</strong></td><td style='border-bottom:#333333 1px solid'><strong>Start Date</strong></td><td style='border-bottom:#333333 1px solid'><strong>End Date</strong></td></tr>"); var x=xmlDoc.getElementsByTagName("link"); for (i=0;i<x.length;i++) { document.write("<tr><td style='border-bottom:#333333 1px solid'>"); document.write(x[i].getElementsByTagName("type")[0].childNodes[0].nodeValue); document.write("</td><td style='border-bottom:#333333 1px solid'>"); document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue); document.write("</td><td style='border-bottom:#333333 1px solid'>"); document.write(x[i].getElementsByTagName("description")[0].childNodes[0].nodeValue); document.write("</td><td style='border-bottom:#333333 1px solid'>"); document.write(x[i].getElementsByTagName("code")[0].childNodes[0].nodeValue); document.write("</td><td style='border-bottom:#333333 1px solid'>"); document.write(x[i].getElementsByTagName("startdate")[0].childNodes[0].nodeValue); document.write("</td><td style='border-bottom:#333333 1px solid'>"); document.write(x[i].getElementsByTagName("enddate")[0].childNodes[0].nodeValue); document.write("</td></tr>"); } document.write("</table>"); </script> [CODE] Thanks, M8AL Good morning, On my website I want a centered popup where you can fill in a webform. Ofcourse I want to use a table for it so it can have a nice layout. However when I use a "div" which I can show or hide via a Javascript (showhide) and I put a table in that div, then the webform in that table is already show on the upper left side of my website. If I click the link to show the div, only a blank div will appear in the center of my screen. This is the code I used: <script type="text/javascript"> function showhide(id) { if (document.getElementById(id).style.display == 'block') { document.getElementById(id).style.display='none'; } else { document.getElementById(id).style.display='block'; } } </script> <div id="test" style="display:none; position: absolute; width: 600px; height: 300px; display: none; background: url('tableupperleft.bmp') repeat-x; border: 1px solid #000; left: 50%; margin-left: -300px; top: 50%; margin-top: -150px;"> <table> <tr> <td align="center">TEST</td> </tr> </table> </div> <a href="javascript:showhide('test')"><img src="iconadd.bmp"></a> In this case the word "TEST" will appear in the upperleft of my screen while the div is hidden. If I click the link, a blank div will appear in the center of the screen. If I don't use a table, bu only the word "TEST", then all works fine like it supposed to be. So I guess the issue is the <table>-function? What am I doing wrong? This is a class assignment and I can't get it to run. I can't figure out what's wrong. This is most of the script. One part isn't finished yet, but I was still expecting functionality to test. I need to have it load in IE but I can't get it to. Nothing shows up. In Firefox I get the right look but when I click "Run" I don't get a prompt at all. It's not very long. var finalCost; var originalPrice; var markedPrice; var delivery; var tradeIn; var deliveryCharge; var tradeCredit; var discountedPrice; function driverModule_click() // <<< DO NOT CHANGE THIS LINE { // <<< DO NOT CHANGE THIS LINE //================================================================================================== // Module Name: <--- Enter the driver module name from your logic solution. //================================================================================================== //================================================================================================== // Place your code here //================================================================================================== markedPrice = Number( prompt("Please enter the marked price of the bed.", "") ); delivery = prompt("Does the customer need the new bed delivered (Y or N)?", ""); tradeIn = prompt("Does the customer have a trade in (Y or N)?", ""); if(markedPrice > 100) { discountedPrice = markedPrice * .15; } else if(finalScore > 90) { discountedPrice = markedPrice * .14; } if(delivery == "Y" || delivery == "y") { deliveryCharge = 20; } else { deliveryCharge = 0; } if(tradeIn == "Y" || hasExtraCredit == "y") { tradeCredit = 5; } else { tradeCredit = 0; } finalCost = discountedPrice + deliveryCharge - tradeCredit; labelout.value = labelout.value + "The cost to you for the bed is " + finalCost + "\n"; labelout.value = labelout.value + "The original price was " + markedPrice + "\n"; Hi friends.... I have an alert message just like Code: alert("Hiii"); I want to close it automatically as soon as it appears. It means I don't want to show this alert message to client. Can anyone tell how i can do it??? Please help me...... Thanks in advance.... I am currently using this: Script Title: Modular Scroller (Scrollable content script III) - Demo The two links providing information can be found he http://www.dynamicdrive.com/forums/s...ad.php?t=11899 / http://home.comcast.net/~jscheuer1/s...side_table.htm I figured out how the script works. The only problems I'm having are I would like to get rid of the border that is around the container and the up and down images. Also, I would like it so that as the browser window gets bigger or smaller, the width and height of the content div expands with the browser. Here is what I have right now: http://gds.parkland.edu/student/fall...inal/menu.html There is a comment section on a blog that I follow, and the blogmaster decided to try to put in a preview button. I found a site that had some code purporting to do just this http://ramui.com/Java_script_code_ex...html-code.html He pulled the code down and inserted it, making what appeared to be no significant changes. The actual code used: Code: <script type="text/javascript"> function showPreview() { var s=document.getElementById('comment').value; if((s.length>1000)||(s.length<1)){alert("Code length must be within 1 to 1000 characters."); return false;} document.getElementById('commentpreview').innerHTML=s; } </script> with the invoking code as: Code: <input type="button" value="Preview" onclick="javascript:showPreview()" /> Unfortunately, the preview strips all hard carriage returns and multiple spaces out. The result is one long paragraph that is more unreadable than the original. What can be done to keep the formatting? Hi guys. I'm trying to write a macro, but I'm lost. So say if I have an array of keywords to check for on a web page, Code: var keywords=new Array(); keywords[0]="You are a cat"; keywords[1]="Are you a robot"; keywords[2]="Have a good summer"; How would I make a function that checks the currently opened web page for one of the specific keywords. And if that keyword is found, then execute some action - and if not, then execute some other action? Thanks |