JavaScript - Working In Html But Not Jsp
Hi
i would like to get my script working in a netbeans project in a .jsp format what changes do i have to make, i stored the images the same place as the .jsp but they don't show Code: <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>index</title> <script language="JavaScript1.1"> <!-- var slideimages=new Array() var slidelinks=new Array() function slideshowimages(){ for (i=0;i<slideshowimages.arguments.length;i++){ slideimages[i]=new Image() slideimages[i].src=slideshowimages.arguments[i] } } function slideshowlinks(){ for (i=0;i<slideshowlinks.arguments.length;i++) slidelinks[i]=slideshowlinks.arguments[i] } function gotoshow(){ if (!window.winslide||winslide.closed) winslide=window.open(slidelinks[whichlink]) else winslide.location=slidelinks[whichlink] winslide.focus() } //--> </script> </head> <body> <h1>slide show</h1> <a href="javascript:gotoshow()"><img src="img1.jpg" name="slide" border=0 width=200 height=200></a> <script> <!-- slideshowimages("img1.jpg","img2.jpg","img3.jpg","img4.jpg") slideshowlinks("") var slideshowspeed=2000 var whichlink=0 var whichimage=0 function slideit(){ if (!document.images) return document.images.slide.src=slideimages[whichimage].src whichlink=whichimage if (whichimage<slideimages.length-1) whichimage++ else whichimage=0 setTimeout("slideit()",slideshowspeed) } slideit() //--> </script> </body> </html> sorry if this is in the wrong place -is a noob- Similar Tutorialshi whats wrong with this? <!DOCTYPE HTML> <HEAD> <script type="text/javascript"> //-- function onLoad() { document.GetElementById("login").innerHTML = "hello"; } --// </script> <TITLE>Steve's FS.</TITLE> <style type="text/css"></HEAD> <BODY onload="onLoad()"> no effect no errors using google chrome and javascript is enabled is it a html 5 thing im not jet aware of? i have done this a million times???? Hi, Posting this in javascript because the problem might be caused by my scripting. I made a 3 page long form using javascript, and the contents of the second page aren't submitted to the php script. link Hope someone can check it for errors. Thanks! I'm having trouble inserting two jquery scripts into the same HTML file. they both work independently, but when i try to use them both at the same time only one script will work.. I'm using a "slider gallery" and "ez background-resize". I've read a few articles that suggest using "var jQuery_1_2_6 = $.noConflict(true);" but i just can't seem to figure it out. Any one have any thoughts or suggestions? I'd really appreciate it. Code is below. 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>Total City Sports</title> <link href="css/screen.css" rel="stylesheet" type="text/css" media="screen" /> <link href="css/styles.css" rel="stylesheet" type="text/css" /> <link href="css/reset.css" rel="stylesheet" type="text/css" /> <style type="text/css"> </style> <!-- start slider gallery--> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/easySlider1.7.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#slider").easySlider({ auto: true, continuous: true, numeric: true }); }); </script> <!-- end slider gallery --> <!--start bg resize --> <script src="js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script> <script src="js/jquery.ez-bg-resize.js" type="text/javascript" charset="utf-8"></script> <script> $(document).ready(function() { $("#body-background").ezBgResize(); }); $(window).bind("resize", function(){ $("#body-background").ezBgResize(); }); </script> <!-- end bg resize--> </head> I hope I have this post in the right place! Any help would be very much appreciated... I have a feature on my website that allows users to choose the website background (using alternate css sheets) and then uses an externally linked javascript file to store the background choice as a cookie so it is consistent throughout the website. This works perfectly locally (i.e. when previewing my website on my computer) but now it is uploaded to my host it doesn't appear to be working. (with the same browser) My javascript is he http://www. b r p - e n v .com/javascript/backgroundchange.js (with no spaces) The website that the javascript file is linked to is http://www. b r p - e n v .com (with no spaces) In the head I have: <script type="text/javascript" src="../javascript/backgroundchange.js"></script> ...then I have: <body onload="set_style_from_cookie()"> ...and for users to choose which background: <form> <input type="image" src="../images/white-background-thumb.jpg" onclick="switch_style('bg1');return false;" name="theme" value="White" id="bg1"> etc... </form> My problem is: The background reverts back to the default when moving to a different page. This would indicate that the background choice is not being saved in cookies. But this works locally! I have tried putting the javascript directly onto each page but I still had the same problem. I hope someone can help, I will be so grateful if I can get this to work. Many thanks indeed! Ok, here's the page as it is right now: http://www.crackin.com/dev/index.php The paganation for the top 3 images is Sweet Pages: http://tutorialzine.com/2010/05/swee...tion-solution/ The content loading below is a page-replace script I got he http://css-tricks.com/dynamic-page-replacing-content/ And I'm also trying to integrate shadowbox (or lightbox, whichever will work) into the lower set of images. I have 2 problems right now I can't figure out, and I'm sure it somehow has to do with the fact I'm trying to mash 3 different JS addons into a single page, I'm still pretty new to this whole JS thing... First problem I'm having is that IE7 and Opera don't like the links in the upper images. Clicking a gallery image does not load the associated page below from those 2 browsers, however IE8 and FF seem to work fine. Second problem is getting shadowbox/lightbox to work on those lower images. I tried a couple different things but main thing I did is make sure the script is actually working by setting the header text to a link with shadowbox attached and that worked. That same link doesn't work when applied to the lower images (loads image in new window). Lightbox does the same thing. Thanks for any help. Hi All, I have two sites using zeroclipboard (hosted at google code) one works only in firefox and barely, the other is not working at all. It does use Flash, but I think the issue is on the js side of things. On both links, clicking the filename below the thumbnail will copy and add the link as an IMG code to a div below. *working* link http://pics.boasbysatyra.com/access/spiders.php This one only works in FF, and the clip area is offset badly. Here is the template for the zc code: Code: <div class="photo" style="float: left; padding: 4px;"> <div class="exif"><a href="[~41~]?dir=[+images_dir+]&file=[+filename+]" rel="shadowbox[exif_[+content_id+]]" title="exif data for [+filename+]" alt="exif data for [+filename+]">EXIF Data</a></div> <a class="thumb" rel="shadowbox[[+content_id+]]" href="[+images_dir+][+filename+]" title="[+title+] | [+description+]"> <img src="[+thumbs_dir+][+filename+]" alt="[+title+]" /> </a> <div class="filecode" id="d_clip_button[+filename+]">[+filename+] <script language="JavaScript"> var clip = new ZeroClipboard.Client(); clip.setText( 'http://pics.boasbysatyra.com[+images_dir+][+filename+]' ); clip.glue( 'd_clip_button[+filename+]' ); clip.addEventListener( 'onComplete', my_complete ); function my_complete( client, text ) { $('.picklist').append('<div class="piclinks">[IMG]' + text + '[/IMG]</div>'); } </script> </div> </div> And the JS for the page: Code: var needRef; //flag for page reload function pEdit(){ needRef = 1; } Shadowbox.init({ handleOversize: "resize", modal: true, initialHeight: 32, initialWidth: 400, overlayOpacity: 0.85, onClose: function(){//check for reload flag and reload if (needRef == 1){window.location.href=window.location.href;} } }); ZeroClipboard.setMoviePath('/js/zc/ZeroClipboard10.swf'); function initMenu() { $('#menu ul').hide(); $('#menu ul:first').show(); $('#menu li a').click(function() { var checkElement = $(this).next(); if ((checkElement.is('ul')) && (checkElement.is(':visible'))) { //return false; } if ((checkElement.is('ul')) && (!checkElement.is(':visible'))) { $('#menu ul:visible').slideUp('normal'); checkElement.slideDown('normal'); return false; } }); } $(document).ready(function() { initMenu(); }); Now on to the totally broken one - it creates the elements required, but gives them a 0x0 area! http://jb.boasbysatyra.com/forum-pic...cs/nature.html Code: div class="photo" style="float: left; margin: 4px;"> <div class="exif"><a href="[~133~]?dir=[+images_dir+]&file=[+filename+]" rel="shadowbox[exif_[+content_id+]]" title="exif data for [+filename+]" alt="exif data for [+filename+]">EXIF Data</a></div> <a class="thumb" rel="shadowbox[[+content_id+]]" href="[+images_dir+][+filename+]" title="[+title+] | [+description+]"> <img src="[+thumbs_dir+][+filename+]" alt="[+title+]" /> </a> <div id="d_clip_container[+filename+]" style="position:relative; width: 120px; height: 0.5em;"> <div class="filecode" id="d_clip_button[+filename+]">[+filename+] <script language="JavaScript"> var clip = new ZeroClipboard.Client(); clip.setText( 'http://jb.boasbysatyra.com[+images_dir+][+filename+]' ); clip.glue( 'd_clip_button[+filename+]','d_clip_container[+filename+]' ); clip.addEventListener( 'onComplete', my_complete ); function my_complete( client, text ) { $('.picklist').append('<div class="piclinks">[IMG]' + text + '[/IMG]</div>'); } </script> </div> </div> </div> On this one I wrapped it as suggested on the zc site, I originally started with the code for the other site - it didn't work, so I went tweaking... Here is the JS: Code: var needRef; //flag for page reload function pEdit(){ needRef = 1; } Shadowbox.init({ handleOversize: "resize", modal: true, initialHeight: 32, initialWidth: 400, overlayOpacity: 0.85, onClose: function(){//check for reload flag and reload if (needRef == 1){needRef = 0; window.location.href=window.location.href;} } }); ZeroClipboard.setMoviePath('/js/zc/ZeroClipboard10.swf'); $(document).ready(function() { $(".dim img").fadeTo("slow", 0.65); $(".dim img").hover(function(){ $(this).fadeTo("slow", 1.0); },function(){ $(this).fadeTo("slow", 0.65); }); $('#mainContent').hide().fadeIn(1200); //When page loads... $(".tab_content").hide(); //Hide all content // $("ul.tabs li:first").addClass("active").show(); //Activate first tab // $(".tab_content:first").show(); //Show first tab content //On Click Event $("ul.tabs li").click(function() { $("ul.tabs li").removeClass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab $(".tab_content").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active ID content return false; }); }); (function($) { $(document).ready(function(){ $('.menu1').ptMenu(); $('.menu2').ptMenu({vertical:true}); }); })(jQuery); I have taken a look at this for a few days and tried many things with no luck, any help is appreciated. Thanks! hereis the html file and javascripton click of this button a html ***************************** <table class=matcolor id=topnav cellspacing=0 cellpadding=0 width=550 border=0 bgcolor="#FFCCCC"> <tbody> <tr align=middle> <td id=menu1 onMouseOver="this.className='mPrimaryOn';showmenu(this);" onClick="this.document.location.href=''" onMouseOut="this.className='mPrimaryOff';hidemenu(this);" class="mat" height="20"> <div align="center"><font color="#FF0000">Desk Top Publishing </font></div> </td> <td width=1 bgcolor=#ff9900 class="mat"></td> <td id=menu2 onMouseOver="this.className='mPrimaryOn';showmenu(this);" onClick="this.document.location.href=''" onMouseOut="this.className='mPrimaryOff';hidemenu(this);" class="mat" height="20"> <div align="center"><font color="#FF0000">Transcription</font></div> </td> <td width=1 bgcolor=#ff9900 class="mat"></td> <td id=menu3 onMouseOver="this.className='mPrimaryOn';showmenu(this);" onClick="this.document.location.href=''" onMouseOut="this.className='mPrimaryOff';hidemenu(this);" class="mat" height="20"> <div align="center"><font color="#FF0000">Accounts Processing </font></div> </td> </tr> </tbody> </table> ***************************************** <script language=JavaScript> ix = document.getElementById('tblmenu1').getBoundingClientRect(); new ypSlideOutMenu("menu1", "right",ix.left + ix.right ,ix.bottom + 10); </script> **any thing i have to alter to work in firefox please help I have a usercontrol which get inputs from the user and show the slideshows. I have added jquery.js and jqfancytransitions.js to the control. when i apply the effects dynamically it is working on local iis but the same coding is not working on iis server. The link for the page is http://www.gloriatech.com/slideshow.aspx . Actually it display the images but no effects are applied. I also checked the js files, it is in right path only.When i checked this page in firebug , it shows the error which is " Sys is undefined". I dont know how to solve it. Can anyone help me? Thanx in advance. favorite I'd like to modify a form on www.formsite.com (form builder app): username: testuser password: password I would like to use the nicedit.com's inline content editor's js to transform my textarea's into a richtext area. At present the nicedit editor works well in creating the richtextarea. However, the KEY point is that I would like formsite's form to pipe in the the created html and render it with the html component of formsite. Currently, the pipe function in formsite will only put out the html syntax in it's html module. action seen he http://fs8.formsite.com/testform/form1/index.html So this would be: 1. checking out my form on formsite.com 2. the script from nicedit.com is already installed in an html component. 3. changing or telling me the scripts/tags/or whatever for formsite form using formsites form builder (which allows some html/script editing). 4. changed so as to render the rich text entered on page 1 in page 2 instead of the html syntax. Any other solutions using formsite and any other richtextarea solutions would be great too! If I have a javascript var in a webpage(html form textarea VALUE - yui) that contains html code, and want to appear it, in confirmformpage.php, then how to transfer it...? is it really needed go via PHP ...? and ofcourse use innerHTML to write it....yes I usually use an intermitened processform.php script. http://developer.yahoo.com/yui/editor HI, i know this must be old js because 'language' is deprecated but, I would like to know where this script gets the word 'Name:' from for the output after I entered dat to the textbox. Code: <HTML> <HEAD> <script language="javascript"> <!-- function send_onclick(frmName) { var bolSubmit; bolSubmit = true; if (frmName.email.value == "") { alert("You must enter an email address"); bolSubmit = false; } if (bolSubmit == true) { frmName.submit(frmName); } } //--> </script> </HEAD> <BODY> <form name="frmName" method="post" action="validate.asp"> Enter your name in the text box. If nothing is entered, a warning message will be displayed. <br>Only when you enter something into the text box will the page be submitted. <br><br> Please enter your name : <INPUT TYPE="TEXT" name="email" size="20"><br> <INPUT TYPE="button" name="butSent" value="Do it" language="javascript" onclick="return send_onclick(frmName)"> </form> Name : d </BODY> </HTML> I guess its from the 'name' of name='email' but how does it do it. Is this next part grabbing everything that was submitted as if a key/value pair? Code: if (bolSubmit == true) { frmName.submit(frmName); } bazz I am trying to use "&&" like in PHP, but JavaScript doesn't like it: Code: if (document.forms["form"]["30"].value == "" && document.forms["form"]["32"].value == "") {foobar;} So, if both these conditions are true, then foobar. Does anyone know why it doesn't work? Can you please take a look at this and tell me why it is not getting all the way thru the function and why this is not working totally. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <script type="text/javascript"> function cabFair(start, end, time){ var base = 0; if (start = 1){ if (end = 1){ base = 5; }if (end = 2) { base = 7; }base = 8; }if (start = 2){ if (end = 1){ base = 7; }if (end = 2) { base = 5; }base = 9; }if (end = 1){ base = 8; }if (end = 2) { base = 9; }base = 5; //return(base); if (time > 20){ time1 = (time - 20); time2 = (time1 * (.3)); finalTime = (time2 + 10); }if (time > 10 && time <= 20){ time1 = (time - 10); time2 = (time1 * (.4)); finalTime = (time2 + 6); }if (time >4 && time <= 10){ time1 = (time - 4); time2 = (time1 * (.5)); finalTime = (time2 + 3); }finalTime = (time * .75); var fare = finalTime + base; return fare } </script> </head> <body> <script type="text/javascript"> //Ask user for input var start = parseInt(prompt("Enter the Starting Point", "1")); var end = parseInt(prompt("Enter the Ending Point", "2")); var time = parseInt(prompt("Enter the Total Time", "4")); //output for information document.writeln(cabFair(start, end, time) + " Is the Total Fare."); </script> </body> </html> hi jus want to ask why is the else not working in the showmore and showless function i have two div which shld conduct the same way of working which is to show the rest of the text with the show more and min the text with the show less function anyone know what my mistake is? Code: function showmore() { if (document.getElementById("mydiv1") ){ document.getElementById("mydiv1").innerHTML = ""; document.getElementById("mydiv1").innerHTML = txt1 + "<font color = '#0000FF' size = '1'><a onclick='showless();return false'>.....read less</a>";txt1; } else { document.getElementById("mydiv").innerHTML = ""; document.getElementById("mydiv").innerHTML = txt + "<font color = '#0000FF' size = '1'><a onclick='showless();return false'>.....read less</a>";txt; } } function showless() { if (document.getElementById("mydiv1")){ document.getElementById("mydiv1").innerHTML = shorttxt1 + "<font color = '#0000FF' size = '1'><a onclick='showmore();return false'>.....read more</a>"; } else { document.getElementById("mydiv").innerHTML = shorttxt + "<font color = '#0000FF' size = '1'><a onclick='showmore();return false'>.....read more</a>"; } } thanks Reply asap!!! check out this page http://qa-www.inmarkit.net/cu.php (you might see an ERROR like "Notice: Undefined index: SCRIPT_URI ... on line 23" THAT'S FINE - that page sets a cookie to allow you to see the header with login on homepage) then go to the homepage: http://qa-www.inmarkit.net/ and try to click on "Log In" in top right corner a overlay with iFrame opens IE7 but not in IE8 can anyone point me in the right direction... what's the right way to handle something like this? approach? steps? techniques? tools? Thank you... PS Looking for general advise - but perhaps you are up to the challenge and see the exact cause? I think that if there is more space between the columns that it would be easier to read, but whatever I try is not working. Just putting tabs between them is my latest idea, however, the space is not all that big. Is it possible that I have entered it wrong? Thank you, the code is below: <html> <head> <title>Exercise</title> <script type = "text/javascript"> <!-- var row = 0; var cols = 0; var sum = (row + 1); if (row ==0) { document.write("sum   square   cube"); document.write("<br>"); row++; } while((row >= 0) && (row <= 11)) { document.write(row + "\t" + (row * row) + "\t" + (row * row * row)); document.write("<br>"); row++; } // --> </script> </head> <body> <p>what? seriously, this is working?</p> </body> </html> Script::. Code: <script language="javascript"> function temp(form) { oops = ""; var sum = 0; var fld = (form.level.value); var val = fld.value.replace(/\s/g, "" ); if ( val != "") { var deg = parseFloat(fld.value); if ( isNaN(deg) || deg < 0) { fld.value = "0"; oops += "\nInvalid Level"; } else if ( deg != 0 ) { sum += Math.pow( deg, 3 );} } if ( oops != "" ) { alert("You must correct these errors:\n" + oops); return false; } form.totalexp.value = sum ; } </script> Html::. Code: <form style="text-align:center"> <p>Level</p> <p><input size=30 maxlength=30 value=0 name="level" onfocus="this.value=''"/></p> <input type=button onclick=temp(this.form) value=Calculate /> <input type=reset name=clear id=clear value=Clear /></p> <blockquote><p>Total Exp <input name="totalexp" size=40 maxlength=40 readonly=""/></p></blockquote></form> Can someone help me. Whats wrong with my js code and i am noob to J.S. Your help is most appreciated. This is not working, any idea ? Code: function respuestas1() { var radios=document.getElementsByTagName("input"); var values; for (var i=0; i<radios.length; i++) { if (radios[i].type==="radio" && radios[i].checked) { values=radios[i].value; sum = 0; for (var i=0; i<values.length; i++) { sum = sum + Number(values[i]); alert(sum); } } } } Won't validate help...pasor error? Wtf i suck at this. Code: <?xml version="1.0" encoding="UTF-8"?> <!--Prolog Above--> <!--dataset is the name of the Root Element--> <!--Artist, Album, and, Publisher are the names of the namespaces, Ar, Al, and, Pu are the prefixes--> <dataset xmlns:Al="Album" xmlns:Ar="Artist" xmlns:Pu="Publisher" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <!--Elements, blank text is data--> <dataset> <Al:Album> <Al:Album ID =""> <Al:Genre =""></Al:Genre> <Al:AmountSold =""></Al:AmountSold> <Al:PublishDate =""></Al:PublishDate> <Al:Artist =""></Al:Artist> </Al:Album> </Al:Album> <Ar:Artist> <Ar:Artist ID =""> <Ar:Awards =""></Ar:Awards> <Ar:Location =""></Ar:Location> <Ar:Region =""></Ar:Region> <Ar:LabelID =""></Ar:LabelID> </Ar:Artist> </Ar:Artist> <Pu:Publisher> <Pu:Publisher ID =""> <Pu:AmountSold =""></Pu:AmountSold> <Pu:Artist = ""></Pu:Artist> <Pu:PublishDate =""></Pu:PublishDate> <Pu:Manager = ""></Pu:Manager> </Pu:Publisher> </Pu:Publisher> </dataset> |