JavaScript - My Asp Is Looping But Not Inside A Div From Thickbox
hi,
in my code below I am using inlinecontent from thickbox which works but inside the <div id="myOnPageContent"> only shows the first Category Name and doesn't loop through but it is looping outside as it shows a different Category Name at teh top of my inline content please help! Code: <td class="smallcelltext"><input alt="#TB_inline?height=150&width=400&inlineId=myOnPageContent" title="Edit <%= rs1("CategoryName") %> Category" class="thickbox" type="button" value="edit" /> <div id="myOnPageContent"> <p> <form> edit <%= rs1("CategoryName") %>: <input type="text" name="CategoryName" value="<%= rs1("CategoryName") %>" /> </form> </p> </div> </td> Similar Tutorialshi, on my website http://zend.warrencreative.com/gemini-group/index.html I am using thickbox, if you click on Subscribe to newsletter at the top it opens up a box, I need to change type="button" to type="image" but this doesn't work?! is there any other way? Code: <a class="newsletter thickbox" href="#TB_inline?height=325&width=365&inlineId=myOnPageContent&modal=true">Subscribe to eNewsletter</a> <div id="myOnPageContent" class="hidden"><p>Please enter your Name:</p><p><input type="text" name="name" class="textbox"></p><p>Please enter your Email:</p><p><form action="#"><input type="text" name="email" class="textbox"></p><p> </p><p><input type="button" value="Send" class="thickbox" title="add a caption to title attribute / or leave blank" alt="#TB_inline?height=325&width=365&inlineId=myOnPageContent1"> <input onclick="tb_remove()" type="image" alt="cancel button" src="images/cancelbutton.jpg"></form></p></div> <div id="myOnPageContent1" class="hidden"><p>Thank you for subscribing</p><input onclick="tb_remove()" type="image" alt="cancel button" src="images/cancelbutton.jpg"></div> thanks in advance I need to loop through an array like this one: [1,2,4,8,8,16,32,64] I don't really know how to do this, so a little guidance would be great. Basically, I have 4 vars: a b c and d in the form of (ax + b)(cx + d) inside the loop something like this: i++ a = array[i] If (a*b > Math.floor(a) && a*b < Math.ceil(a)){ then increment i again and do the loop again} else{ break the loop and set leave a = array[i] } A code sample or something would be really nice (I don't know how to do the parts that are written out in text... Thanks! } hi to all... good day to u all... i have a noob question i followed this instruction Code: for (count=1; count<11; count++) { javascript code here } at the bottom of my page i did this Code: <script type="text/javascript"> for (counter=1; counter<11; counter++) { var followTrigger+counter+a = new Spry.Widget.Tooltip('following'+counter+'a', '#followMe'+counter+'a', {followMouse: true}); } </script> what im trying to do is to make multiple of this Code: <script type="text/javascript"> var followTrigger1a = new Spry.Widget.Tooltip('following1a', '#followMe1a', {followMouse: true}); var followTrigger2a = new Spry.Widget.Tooltip('following2a', '#followMe2a', {followMouse: true}); var followTrigger3a = new Spry.Widget.Tooltip('following3a', '#followMe3a', {followMouse: true}); var followTrigger4a = new Spry.Widget.Tooltip('following4a', '#followMe4a', {followMouse: true}); var followTrigger5a = new Spry.Widget.Tooltip('following5a', '#followMe5a', {followMouse: true}); var followTrigger6a = new Spry.Widget.Tooltip('following6a', '#followMe6a', {followMouse: true}); var followTrigger7a = new Spry.Widget.Tooltip('following7a', '#followMe7a', {followMouse: true}); var followTrigger8a = new Spry.Widget.Tooltip('following8a', '#followMe8a', {followMouse: true}); var followTrigger9a = new Spry.Widget.Tooltip('following9a', '#followMe9a', {followMouse: true}); var followTrigger10a = new Spry.Widget.Tooltip('following10a', '#followMe10a', {followMouse: true}); </script> i dont know why it wont work... any help pls... public static void main(String[] args){ int oddNo; oddNo = getOdd(); } public static int getOdd(){ int oddNo = 0; Scanner sc = new Scanner(System.in); while (oddNo % 2 == 0){ System.out.print("Enter an odd number : "); oddNo = sc.nextInt(); System.out.println("Wrong input ! "); } if (oddNo % 2 !=0); System.out.print("The odd number is : " + oddNo); return oddNo; } however, the output: Enter an odd number : 10 Wrong input ! Enter an odd number : 8 Wrong input ! Enter an odd number : 9 Wrong input ! (how to remove this?) The odd number is : 9 hi there, I need to ask my users to input some numbers via textbox(or prompt) using a DELIMITER (,) between each digit. Then The program will display(list) when clicking a button. for this I will use three columns in the first column I have (2,4,6,9) to prompt. in the second column I have (3,4,7,10) to prompt. in the third columns I have (5,6,11,14) to prompt so the first lines should look like: 2,3,5 2,3,6 2,3,11 .... .... .... and the last line : 9,10,14 there should be 4x4x4=64 rows/lines How can we achieve this ? Thanks in advance Hi ive got this code that hides the productPrice div if the productPrice div inner html is equal to $0.00 So far this works for the first product item on the page but how can i loop this so that it hides every productPrice div on the page? Code: function hide() { var intotal=document.getElementById('productPrice').innerHTML; if (intotal) { intotal=parseFloat(intotal.substring(1).replace(/,/gi,"") ); if (intotal == 0.00) { document.getElementById('productPrice').style.display = "none"; } } } hide(); cheers, help would be very much appretiated Code: function funt() { var link = document.getElementsByClassName("class")[0]; if(link != null) { var i = 0; if(check != link.childNodes[i]) { link.childNodes[i].click(); check = link.childNodes[i]; } else { window.location = "website" } } else { if(document.getElementById('enbut').value != "some value") { document.getElementById('id').click(); } window.location = "website" } t=setTimeout("funt()",3000); } with this i'm trying to get it to loop every 3 seconds using the settimeout function at the end of the loop. each time i run this it just runs once and exits. anyone know what i'm doing wrong? 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 Hi, I have this code.. Code: javascript:function showMore() {ProfileStream.getInstance().showMore(); setTimeout(showMore, 2000)}; showMore(); i want to loop it 10 times, but do not know how to do it. I have been told that the for var command is what I want, but I cannot get it to work. Any help would be appreciated. Thanks We were given a task at school today. Basically we need to have a prompt box popup, and the user enters numbers 1-12 (1 for each month of the year). The prompt keeps popping up until the user types "stop". It will display the months that were entered. Could anyone assist me with this, thanks. I have a script where I can PregReplace soething in a string with a defined value from my input field and it works like a charm. Code: <?php echo '<input id="pfrom" type="text" value="" name="pfrom">'; ?> <script> function demoRegex(){ var txt = document.newform.thestring.value; var re = new RegExp(document.newform.pfrom.value, "g"); newtxt = txt.replace(re,''); alert(newtxt); } </script> But what if I have multiple input field like this: PHP Code: foreach($arr as $arr1=>$value){ echo '<input id="pfrom" type="text" value="" name="pfrom[]">'; } How do I get the javascript to run through all the fields? Hoping for help.... Thanks in advance ;-) hat i'm trying to achieve is to add two numbers using do while loop. below is the code however result wont show up. i cant seem to determine the error. help me pls. Quote: <script = "text/javascript"> function myanswer(x,y){ x=parseInt(x); y=parseInt(y); i=1; sum=0; do { sum=x+i; i++; } while(i<y) document.myform.asnwer.value=sum; } </script> <form name='myform'> Enter First number:<input type='text' name='x'></br> Enter Second number:<input type='text' name'y'></br> Result:<input type='text' name='answer'></br> <input type='button' value='Click on Me!' onclick="myanswer(myform.x.value,myform.y.value);"</br> </form> Hi Guys, I am trying to create a game similar to this https://www.carchallenge2014.com/practice.php What I want to know is how can I run a script so that the script will be able to click on the hands and increase the score. Willing to pay for the help as well. Tks First time poster. so be kind Hi All, I have found a bit of shared code on the net that can be used on Facebook. The way it is used is on profiles, or groups, that extend beyond an original page. You load the page and then paste the script into the address bar (in FF and chrome) and hit enter. This then goes down and looks for the 'older post' tag and expands it every 4 seconds. When it gets to the end of the group, it does not stop, it just goes into a loop and restarts from the beginning. I am wanting help to get it to stop at the end of the first pass. This is the code: Code: javascript:function clrt(){alert('Stopped Post Load');if(f_sM){clearTimeout(f_sM);}};function showMore(){ProfileStream.getInstance().showMore();f_sM = setTimeout(showMore, 4000); xsm=document.getElementById('profile_pager_container');xsm.addEventListener('click',clrt,false)}; showMore(); I have also seen it done, with the same looping results, with this code: Code: javascript:function showMore() {ProfileStream.getInstance().showMore(); setTimeout(showMore, 4000)} showMore(); Can anyone help please? Thanks So I have been working on this exercise for about a month. In the book I am reading it say's this:"For each number that the user enters, the text boxes on the web page should display: the last score that was entered, the number of scores that have been entered, the total of these scores, the average score, the best score, and the worst score. When you write the code for this function, you should enclose the prompt method within a loop, but you decide which type of loop is best for this application. Now, write and test the code." The first peice of code is my HTML, and the second piece of code is the function that I have to start from in a .js file. I just seem to be confused at how my structuring needs to be. The 999 in the function is what the prompt says to enter to escape. Code: <body> <div id="content"> <h1>Using Loops</h1> <label for="lastScore">Last Sco </label> <input type="text" id="lastScore" /><br /> <p></p> <label for="scoreCount">Score Count:</label> <input type="text" id="scoreCount" /><br /> <label for="scoreTotal">Score Total:</label> <input type="text" id="scoreTotal" /><br /> <p></p> <label for="scoreAverage">Average Sco </label> <input type="text" id="scoreAverage" /><br /> <label for="bestScore">Best Sco </label> <input type="text" id="bestScore" /><br /> <label for="worstScore">Worst Sco </label> <input type="text" id="worstScore" /><br /> <p></p> </div> Code: var process_test_scores = function () { var testScore; testScore = parseInt(prompt( "Enter a valid test score between 0 and 100.\n" + "To end test score entry, enter 999.", 999)); } I am trying to loop through each area and checking if they match the image class number then it should drop in correct place. You can see that i commented out the loop and if statement because it doesn't work. Can anyone shine light on this because i'm frustrated with this issue. Code: $(document).ready(function(){ var images = $('#clothes').find('img'); var drop = $('#dress').find('area'); for(var a=0; a < images.length; a++){ $( images[a] ).draggable( ); //alert($(images[i]).hasClass("20")); if($(images[a]).hasClass("20")){ $( images[a] ).draggable({ revert: 'valid' }); //alert("WRONG"); } else{ $( images[a] ).draggable({ revert: 'invalid' }); } /*for(var b=0; b < drop.length; b++){ $( drop[k]).droppable({ activeClass: "ui-state-hover", hoverClass: "ui-state-active", drop: function( event, ui ) { $( this ).addClass( "ui-state-highlight" ) /*if($(images[a]).attr('class').split(" ")[0] == $(drop[b]).attr('class')){ alert("RIGHT"); $(images[a]).draggable({ revert: 'invalid' }); } else if($(images[a]).hasClass("20")){ $( images[a] ).draggable({ revert: 'valid' }); } //alert("a = " + $(images[a]).attr('class').split(" ")[0] + " b = " + $(drop[b]).attr('class')); } }); }*/ } }); Hi, I am new to the forum so apologies if I have posted in wrong place ! I have used a script in my site but would like to get the .wav file to loop can anyone advise how to change the script to allow this, I am not very good with Javascript !!!! Here is the Javascript: <!-- Functions Code Block Start--> <script> /* Here we are creating two functions. The first to start a sound object playing and the second to stop a sound object from playing. */ // // This function, when called will play the sound object function EvalSoundPlay(soundobj) { var thissound= eval("document."+soundobj); thissound.Play(); } // This function, when called will stop the sound object function EvalSoundStop(soundobj) { var thissound= eval("document."+soundobj); thissound.Stop(); } </script> <!-- Functions Code Block End--> <!-- Here we are embedding the sound file/s. We give each embedded sound a 'name' that we can refer to in a JavaScript event call. ----- // Note: You can have multiple sounds embedded but remember that each sound requires a different 'name' and each would require its own set of play/pause buttons. --> <embed src="Smooth_Ambience.wav" autostart=false width=0 height=0 name="sound1" enablejavascript="true" /> <!-- This is an example of a second embedded sound. --> <embed src="jingle_bell_rock.mp3" autostart=false width=0 height=0 name="sound2" enablejavascript="true" /> And Here is my HTML <div class="musicPlayer"> <img src="../Assets/Images/Global/play-button.png" alt="music play button" width="40" height="40" onClick="EvalSoundPlay('sound1')"/><img src="../Assets/Images/Global/stop_button.png" alt="music stop button" width="40" height="40" onClick="EvalSoundStop('sound1')"/> </div><!-- End .musicPlayer --> Thanks, Nick C If in my page I have a facebook widget & a pagecounter widget, both I dont want to display on pages other than homepage. I will do 1] Code: <div id="facebook"> .....facebookwidget...</div> <div id="counter">.....counterwidget.....</div> then I will use something like this 2] Code: $(function() { var currentUrl = window.location.href; if(currentUrl != 'http://engineering.forumotion.info/') { $('#facebook').remove(); $('#counter').remove(); } }); However if I use a same id for both widgets say e.g facebook then Code: $(function() { var currentUrl = window.location.href; if(currentUrl != 'http://engineering.forumotion.info/') { $('#facebook').remove(); } }); the above code only removes one(that occurs first) widget & NOT the other widget with the same id. Here we include looping, plz anyone tell me how one start & end a loop, to find a particular class/ID. Plus how the jquery .each() function can be implemented Ok so this is probably a simple question but i have hit a wall he So I have 20 arrays with incremental names (course1, course2, course3 ...) What i want to make is a selection box with 20 options. for each option the value would be course1[0] and the text shown would be course1[1]. if i write this code: <code> for (var i=1; i<=20; i++){ var select = document.getElementById("selectiontest") select.options[select.options.length] = new Option (course1[1], course1[0]) } </code> The code works and the correct array values are put as the option text and value. I am having trouble getting the loop to move from course1 to course2, i used the loop counter in the array name like this: <code> for (var i=1; i<=20; i++){ var select = document.getElementById("selectiontest") select.options[select.options.length] = new Option (('course'+i)[1], ('course'+i)[0]) } </code> this is where it stops working. I get 20 values of o. which i assume is the second character of course. How do i tell javascript to incrementally change the array name during the loop? Im trying to get all of these math functions into one table with each one going into an individual row. The following is what my Grad Assistant gave us as instructions..he is not real helpful..lol The goal of project to is to create a webpage that makes use of javascript to perform a dynamic number of operations. The program must first ask for a number of operations to perform (n).It is therefore required that a loop construct be used. The program will then ask the user n times what operation they would like to perform and the appropriate inputs for that operation. All of the operations will use integer type inputs except ceiling, floor, and round which will use float types. The required operations for this project will be 1. + 2. * 3. / 4. % 5. min 6. max 7. floor 8. ceil 9. round The output of each operation will be stored in a table. The required outputs for each row are the operation requested, the expression for the operation showing its structure (see below), the result of the operation and additionally a random number. The random number should be within one and the number of operations requested. (ex: 5 operations requested, random number is in the range 0-5) A sample of what this output will look like is shown here. let me know if you can help it is much appreciated..the course book does not cover most of what is being taught and in class time could be better spent self taught! lol ..midterms suck and its almost time for the weekend so I could really use some help!! thx again |