Jump to content

scott100

Members
  • Posts

    1,819
  • Joined

  • Last visited

Posts posted by scott100

  1. see example here: http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_checkbox_order

     

    because you have 2 inputs with the same name (contact)

    <input type="checkbox" name="contact" value="E-mail" />E-mail<br /><input type="checkbox" name="contact" value="Phone" />Phone Number<br /><br />

    you will need to use a for loop to cycle through the inputs

    function validateForm(){var contact = document.forms[0].contact;  // Name of input elementvar count = 0;  // count is zerofor (i=0;i<contact.length;i++)  //loop through the contact checkboxes  {  if (contact[i].checked == true) // has the checkbox been ticked?    {       count += 1;  // The checkbox has been ticked so add 1 to the count    }  } if (count == 0)  // if count is still zero then nothings been ticked.{  alert("Please tick a contact box");  return false;}.........
  2. You could use CSS to put a margin around the images http://www.w3schools...n.asp#gsc.tab=0 something like

    <head><style> img{	margin:20px;}</style></head>

    this would affect all images though... you could narrow it down further, this would only apply to images within the form tag

    <head><style>form img{	margin:20px;}</style></head>

  3. If you have no control over the page then you can't edit it. You could try injecting in a little piece of javascript but the change wont be permanent and only you would see ithttp://www.wikihow.c...ript-Injections if you browsed to the page, in IE/Chrome, type this into the address bar and hit return (don't copy and paste as the browser removes the javascript:word) javascript:;alert(currents); this may or may not be of any use.

  4. ok, so you go to this pagewww.domain.com/password/users.aspx you view source and you see var currents="[Jo,0,1250.21][ian,0.10,2578.30][Fred,2.00,249.25][sue,0.30,1157.56][Chris,0.60,0.15][John,3.00,4742.60][Carl,0.50,0.00][Amanda,0.50,1356.89][Zoe,0.50,549.28][Jo,0.50,0.00][Jen,0.50,0.00][Jo,1.00,288.27][Tracey,1.00,1499.20][Colin,1.00,0.00][simon,1.00,0.00][William,1.00,0.00][Ty,5.00,4872.86][Red,2.00,249.27][ian,2.00,1023.41][Jeff,2.00,0.00][Kevin,2.00,0.00][Carol,2.00,0.00]";? Do you have any control over this page (users.aspx)? I notice you said earlier

    Thanks, that's exactly what I need, but can I do that when I don't have any control over what's printed at all? All I have is a url that gives me the values?
    Do you only have read access to this page then? You can't actually edit the files on the server?
  5. What does the url look like? you could try var currents=window.location.href.toString() instead of this var currents="[Jo,0,1250.21][ian,10,2555.11][Fred,2,186.36][sue,0.30,1157.56]";

  6. Hi, if you add a couple of paramaters to the process function - name and initialValue - you can then call it like so: process("Jo","0.50");orprocess("Jo","0"); The if statement can check if the paramters are found and the initial value not eqaual to 0 if ((temp[0] == name) && (initialValue != "0")) { alert("Found " + name + " and initial value is not 0 - total Amount is " + temp[2] ); }

    <!DOCTYPE html><html lang="en"><head><title>split string</title><style>.hdr {font-weight: bold;color: #0f0;}</style><script type="text/javascript" src="jonerror.js"></script><script>window.onload = function() {document.getElementById('out').innerHTML = ''; process("Jo","0.50");  // This will fireprocess("Jo","0");  // This wont fire }var currents="[Jo,0,1250.21][Ian,10,2555.11][Fred,2,186.36][Sue,0.30,1157.56]";  function process(name, initialValue) {   var clean = currents.replace(/\[/g,'');  var arr = clean.split(']');	for (var i=0 ; i<arr.length-1 ; i++) {	var temp = arr[i].split(',');			  if ((temp[0] == name) && (initialValue != "0"))		  {			alert("Found " + name + " and initial value is more than 0 - total Amount is " + temp[2] );		  }		  		  //document.getElementById('out').innerHTML += '<span class="hdr">Name:</span> '+ temp[0];		  //document.getElementById('out').innerHTML += ' <span class="hdr">Initial Value:</span> '+ temp[1];		  //document.getElementById('out').innerHTML += ' <span class="hdr">Total Value:</span> '+ temp[2] +'<br/>'; 	}}</script></head><body><h2>Customer Values</h2><div id="out"></div></body></html>

  7. How about a CGI forum under the category Server Scripting, with two subforums Perl and Python? I know it will make it easier to find the threads particularly for Perl/Python, and it will save us checking and moving threads later on. I think that's the best solution. It would look like this:post-210-1202731189_thumb.png
    looks good to me...
  8. It finally worked :) I chose ASCII and uploaded the script via FTP, refreshed the page and there it was. As a test I made some changes with my built-in editor, after a refresh the error page appeared. Guess I'm stuck using FTP but it's better than nothing :mellow: Thanks for the help guys :)

  9. My permissions are set to 755.I added the Content-type above and i'm still seeing the same error each time i load the page :)EDITI have been doing a bit of googling and found this

    One important thing to remember is to use ASCII mode when you upload scripts to the server. If you think you have everything configured properly but the script won't run, reload it using ASCII mode, just to be sure. It's a common source of error.
    Maybe this is the problem? i am using a text editor supplied by joomla to create the script... How do i reload it using ASCII, will i have to upload the script with a FTP?
  10. I'm a perl person. Can't say I know everything, and I'm a do-it-yourself fanatic, so I stay away from libraries. But I'll help if I can.biggrin.gifJonas, if you're still reading, I would certainly be up for a perl forum. I know enough (in a CGI context) that I can help out the basically bewildered, so if you want to make sure there's at least one answer-person on board, I can fill that roll.
    Thanks for the help, it's as basic as it gets, displaying the old "hello world" script.I have tried saving my file "myscript.pl" in the cgi-bin and in public_html, it's permissions are the same as my PHP, JavaScript and CSS files so i don't think it's that. When i direct the browser to it, it doesn't work, i get a error message. The error message:Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request.The contents of "myscript.pl" are:#!/usr/bin/perlprint "Content-type: text/html";print "hello";Environment Variables are:Operating system LinuxApache version 1.3.37 (Unix)PERL version 5.8.8Path to PERL /usr/bin/perl
  11. Not true. There's a forum for Cold Fusion and Java/JSP pages, and those are not covered by w3schools. We've discussed it before, whether we should make a CGI forum (Python, Perl, etc.), or several separate forums for each language, and I think we decided on postponing our decision, because there didn't seem need for one. Time to reconsider I guess. If people want a PERL forum, I'm sure we could work that out.
    You took the words out my mouth Jonas :) There are Java and Cold Fusion forums which are not on the main site.PERL is still widely used in web development and it would seem suitable it had it's own forum.
  12. AND i have no idea what programming language its in?
    Batch files use internal DOS commandsLooks like your choice is causing the problems, try using this:CHOICE /c 1234 /m "Please choose a menu option."
  13. the 1st document.write(name) is in () with no " in it then the next one is
    Using " " just means print whats inside to screen.
    var name = "Hege"document.write(name)document.write("<h1>"+name+"</h1>")

    document.write(name) - what is name? name is a variable with the value "Hege", so Hege will be printed to screen.If, for example, you said document.write("name") then name would be printed to screen, not Hege - so use of quotations is important.

    why does the next one have + in it.
    + is used to add variables and strings togetherdocument.write("<h1>"+name+"</h1>")This would displayHege
  14. Styling the scrollbar was introduced by Microsoft not W3, so basically it's not part of the standard and therefore won't validate.If you look at your page with another browser like opera or firefox then you will notice that they ignore those definitions.

  15. Yes. That's basically it. If they choose option 1 in select 1 then select 2 will have choices relative to select 1 option 1. Should have only around 3-4 options in the second select.Is AJAX like javascript?
    http://www.w3schools.com/ajax/ajax_database.aspWhen you select from the dropdown the record from the database changes (without the page loading), i guess you make a second dropdown with this new information if you wish.AJAX is partially java script: Asynchronous JavaScript And XML :)But hey i ain't had time to learn AJAX yet :blink: or Coldfusion :) So i'm outta here! :)
  16. Say i submit a website to google, a couple months later i search google for this site using the keywords i have specified, up pops Results 1 - 10 of about 58,000,000So my search begins to see what position this site is at, but searching through 58 million will take a long time. :) So my question is, is there a way for us to know what position our site is at, when using certain keywords, without having to manually check through each of the result pages until we find it? :) Im looking for google to tell me something like: If you search with these keywords "blah,bleh" site "www.whatever.com" is in position number "250"If you search with these keywords "bling,blong" site "www.whatever.com" is in position number "15"thanks

  17. I was surprised to see that IE7 supports the css method, but IE6 does not.Is there a workaround for IE6?
    I just checked it with IE6 and it works fine :) I just downloaded it all and it works ok.i tried it with
    <a href="http://www.yahoo.com" onMouseover="ddrivetip('Visit Yahoo.com')"; onMouseout="hideddrivetip()">Search Engine</a>

    Make sure you have it working first then try puting the javascript into an external file.

  18. I don't think you can do what your asking with imagemaps :) What i would advise is slicing up your navigation image (navbartop.png) into 6 different images, 1 for each button. And then also creating another 6 for the rollover effect.Then use some code like this

    <a href="home.html" alt="Home" target="home"><img src="homebutton.png" onmouseover="this.src='homebutton2.png'" onmouseout="this.src='homebutton.png'"></a>

    <a href="images.html" alt="Images" target="home"><img src="imagesbutton.png" onmouseover="this.src='imagesbutton2.png'" onmouseout="this.src='imagesbutton.png'"></a>

    etc etcSo you will need 12 images in total, normal homebutton and a rollover homebutton etc etc

  19. DHTML is just a buzzword, it's not a language but a collection of technologies.DHTML = XHTML, CSS, Javascript and DOMSo basically if you know the above 4 then your ready for DHTML, it's just about using them all together to access elements on a page and change their properties :)

×
×
  • Create New...